From 205acd7b6952fd3457ea335107bcfc5b2bcccfce Mon Sep 17 00:00:00 2001 From: Satya Patel Date: Thu, 29 Jan 2026 08:58:27 -0800 Subject: [PATCH] feat(desktop): wrap tab navigation hotkeys at list boundaries PREV_TAB and NEXT_TAB hotkeys now wrap around instead of stopping at the first/last tab. --- .../_dashboard/workspace/$workspaceId/page.tsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/workspace/$workspaceId/page.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/workspace/$workspaceId/page.tsx index a6bbc967c16..0855214a4bf 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/workspace/$workspaceId/page.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/workspace/$workspaceId/page.tsx @@ -152,11 +152,10 @@ function WorkspacePage() { useAppHotkey( "PREV_TAB", () => { - if (!activeTabId) return; + if (!activeTabId || tabs.length === 0) return; const index = tabs.findIndex((t) => t.id === activeTabId); - if (index > 0) { - setActiveTab(workspaceId, tabs[index - 1].id); - } + const prevIndex = index <= 0 ? tabs.length - 1 : index - 1; + setActiveTab(workspaceId, tabs[prevIndex].id); }, undefined, [workspaceId, activeTabId, tabs, setActiveTab], @@ -165,11 +164,11 @@ function WorkspacePage() { useAppHotkey( "NEXT_TAB", () => { - if (!activeTabId) return; + if (!activeTabId || tabs.length === 0) return; const index = tabs.findIndex((t) => t.id === activeTabId); - if (index < tabs.length - 1) { - setActiveTab(workspaceId, tabs[index + 1].id); - } + const nextIndex = + index >= tabs.length - 1 || index === -1 ? 0 : index + 1; + setActiveTab(workspaceId, tabs[nextIndex].id); }, undefined, [workspaceId, activeTabId, tabs, setActiveTab],