From 456d3aaf52712b1f99b90fe299853122e1d703c0 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Sun, 9 Jun 2024 08:36:12 -0700 Subject: [PATCH] Don't focus sidebar on cmd+0 --- src-web/components/Sidebar.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src-web/components/Sidebar.tsx b/src-web/components/Sidebar.tsx index 9a07be16..6af18e95 100644 --- a/src-web/components/Sidebar.tsx +++ b/src-web/components/Sidebar.tsx @@ -161,7 +161,7 @@ export function Sidebar({ className }: Props) { const jumpToRequest = async (index: number) => { const r = selectableRequests[index]; - if (r != null) await handleSelect(r.id); + if (r != null) await handleSelect(r.id, { noFocus: true }); }; useHotKey('sidebar.jump_1', () => jumpToRequest(0)); @@ -204,7 +204,7 @@ export function Sidebar({ className }: Props) { ); const handleSelect = useCallback( - async (id: string) => { + async (id: string, opts: { noFocus?: boolean } = {}) => { const tree = treeParentMap[id ?? 'n/a'] ?? null; const children = tree?.children ?? []; const node = children.find((m) => m.item.id === id) ?? null; @@ -224,7 +224,7 @@ export function Sidebar({ className }: Props) { }); setSelectedId(id); setSelectedTree(tree); - focusActiveRequest({ forced: { id, tree } }); + if (!opts.noFocus) focusActiveRequest({ forced: { id, tree } }); } }, [treeParentMap, collapsed, routes, activeEnvironmentId, focusActiveRequest],