Cortex icon indicating copy to clipboard operation
Cortex copied to clipboard

Low: compact sidebar closes even when unsaved-settings navigation is cancelled

Open dovvnloading opened this issue 3 weeks ago • 0 comments

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: both createChat() and selectChat() call navigate(...) then unconditionally closeSidebarOnCompactLayout().
  • navigation.ts:83–110: navigate() may be asynchronously denied by a registered navigation guard, and its return type is void; 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

  1. Resize the app narrower than 760 px; open Settings and modify a value without saving.
  2. Open the chat sidebar and select a saved chat (or New thread).
  3. Actual: the sidebar closes immediately, while the pending Settings guard displays its unsaved-changes prompt.
  4. Choose Keep editing. The route correctly stays in Settings, but the sidebar is now closed despite navigation being cancelled.
  5. 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).

dovvnloading avatar Nov 09 '26 13:11 dovvnloading