feat(ui): remember last visited page per company on company switch

When switching companies via the sidebar rail, dropdown, or keyboard
shortcuts, the app now navigates to the last page visited for that
company instead of staying on the current (now irrelevant) page.
Falls back to /dashboard if no previous page exists.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Forgotten
2026-02-23 14:47:54 -06:00
parent b05ac91aa7
commit cf4b338cd4
2 changed files with 61 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ import { usePanel } from "../context/PanelContext";
import { useCompany } from "../context/CompanyContext";
import { useSidebar } from "../context/SidebarContext";
import { useKeyboardShortcuts } from "../hooks/useKeyboardShortcuts";
import { useCompanyPageMemory } from "../hooks/useCompanyPageMemory";
import { healthApi } from "../api/health";
import { queryKeys } from "../lib/queryKeys";
import { cn } from "../lib/utils";
@@ -58,6 +59,8 @@ export function Layout() {
[companies, setSelectedCompanyId],
);
useCompanyPageMemory();
useKeyboardShortcuts({
onNewIssue: () => openNewIssue(),
onToggleSidebar: toggleSidebar,