Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(sidebar): clicking on sidebar link appends to split history even if it's the same content (#3030)

dev-rb759ee1b24fa9
diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsx
index 5e6339cdf1..d37ec07a7d 100644
--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx
+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx
@@ -766,15 +766,26 @@ const SidebarLink = (props: SidebarLinkProps) => {
if (e.button === 1) return;
e.preventDefault();
- const handle = layout.openWithSplit(content(), {
- preferNewSplit: e.shiftKey,
- mergeHistory: false,
- allowDuplicate: true,
- referredFrom: 'sidebar',
- });
- if (props.id === 'search' && handle) {
- requestSearchFocus(handle.id);
+ let currentContentHandle = layoutManager?.activeSplit();
+
+ const currentContent = currentContentHandle?.content();
+ const isSameContent =
+ currentContent?.type === 'component' &&
+ currentContent?.id === props.id;
+
+ if (!isSameContent || e.shiftKey) {
+ currentContentHandle = layout.openWithSplit(content(), {
+ preferNewSplit: e.shiftKey,
+ mergeHistory: false,
+ allowDuplicate: true,
+ referredFrom: 'sidebar',
+ });
+ }
+
+ if (props.id === 'search' && currentContentHandle) {
+ requestSearchFocus(currentContentHandle.id);
}
+
layoutManager?.returnFocus();
}}
>