From b4bd50caed53eeaa98eacfb829347a611372d720 Mon Sep 17 00:00:00 2001 From: ivanahuckova Date: Mon, 13 Oct 2025 15:46:08 +0200 Subject: [PATCH] Revert "Refactor" This reverts commit ffd901ed0c9db91f611c880cea79ff6c3910c392. --- .../ExtensionSidebar/ExtensionToolbarItem.tsx | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/public/app/core/components/AppChrome/ExtensionSidebar/ExtensionToolbarItem.tsx b/public/app/core/components/AppChrome/ExtensionSidebar/ExtensionToolbarItem.tsx index fa42c47bef9..8b4a67d1c2b 100644 --- a/public/app/core/components/AppChrome/ExtensionSidebar/ExtensionToolbarItem.tsx +++ b/public/app/core/components/AppChrome/ExtensionSidebar/ExtensionToolbarItem.tsx @@ -47,10 +47,12 @@ export function ExtensionToolbarItem({ compact }: Props) { isOpen={isActive} title={component.title} onClick={() => { - const event = isActive - ? new CloseExtensionSidebarEvent() - : new OpenExtensionSidebarEvent({ pluginId, componentTitle: component.title }); - getAppEvents().publish(event); + const appEvents = getAppEvents(); + if (isActive) { + appEvents.publish(new CloseExtensionSidebarEvent()); + } else { + appEvents.publish(new OpenExtensionSidebarEvent({ pluginId, componentTitle: component.title })); + } }} pluginId={pluginId} /> @@ -68,11 +70,12 @@ export function ExtensionToolbarItem({ compact }: Props) { active={dockedComponentId === id} label={c.title} onClick={() => { - const event = - dockedComponentId === id - ? new CloseExtensionSidebarEvent() - : new OpenExtensionSidebarEvent({ pluginId, componentTitle: c.title }); - getAppEvents().publish(event); + const appEvents = getAppEvents(); + if (dockedComponentId === id) { + appEvents.publish(new CloseExtensionSidebarEvent()); + } else { + appEvents.publish(new OpenExtensionSidebarEvent({ pluginId, componentTitle: c.title })); + } }} /> );