Cortex
Cortex copied to clipboard
Low: compact sidebar closes even when unsaved-settings navigation is cancelled
Impact
Low / compact-window navigation — a chat selection closes the sidebar immediately even if Settings' unsaved-changes guard rejects the navigation. After choosing Keep editing, the person remains in Settings but the chat sidebar has disappeared.
Evidence
AppShell.tsx:76–94: bothcreateChat()andselectChat()callnavigate(...)then unconditionallycloseSidebarOnCompactLayout().navigation.ts:83–110:navigate()may be asynchronously denied by a registered navigation guard, and its return type isvoid; the shell does not know whether navigation completed.SettingsPanel.tsx:167–196: the dirty settings view defers navigation while displaying Save/Discard/Keep editing.
Reproduction
- Resize the app narrower than 760 px; open Settings and modify a value without saving.
- Open the chat sidebar and select a saved chat (or New thread).
- Actual: the sidebar closes immediately, while the pending Settings guard displays its unsaved-changes prompt.
- Choose Keep editing. The route correctly stays in Settings, but the sidebar is now closed despite navigation being cancelled.
- Expected: compact-sidebar dismissal should happen only after confirmed route change, or at least restore the sidebar when navigation is denied.
Proposed fix / test
React to confirmed pathname changes instead of closing directly after navigate, or have navigate expose a navigation-outcome promise/callback and close only on approval. Add a compact viewport e2e test covering dirty settings → sidebar chat selection → Keep editing/Discard outcomes.
Reviewed revision: e824fe2dcba0d1be127c9fff165f776186dc37e9. Deterministic async navigation flow; compact window test not executed. Distinct from #424 (native Back bypassing the guard).