From d3c9ff50c7eaec0edad55213d73bc1ed61a40723 Mon Sep 17 00:00:00 2001 From: Dan <12800016+rinslow@users.noreply.github.com> Date: Wed, 11 Jun 2025 16:00:54 +0300 Subject: [PATCH] fix(ToolbarService): Fixed removeButton bug for removing buttons inside sections (#5123) Co-authored-by: Dan Elkis --- .../core/src/services/ToolBarService/ToolbarService.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/platform/core/src/services/ToolBarService/ToolbarService.ts b/platform/core/src/services/ToolBarService/ToolbarService.ts index a132d779e..b69bb8726 100644 --- a/platform/core/src/services/ToolBarService/ToolbarService.ts +++ b/platform/core/src/services/ToolBarService/ToolbarService.ts @@ -172,6 +172,14 @@ export default class ToolbarService extends PubSubService { if (this.state.buttons[buttonId]) { delete this.state.buttons[buttonId]; } + + // Remove button from all sections + Object.keys(this.state.buttonSections).forEach(sectionKey => { + this.state.buttonSections[sectionKey] = this.state.buttonSections[sectionKey].filter( + id => id !== buttonId + ); + }); + this._broadcastEvent(this.EVENTS.TOOL_BAR_MODIFIED, { ...this.state, });