Skip to content

T-G564-document-tabs-do-not-survive-reload

State: planning/draft · Impact: low · Complexity: medium

Pane-collapse state survives a full page reload because it is persisted to localStorage. The open-document-tabs list is not: it lives only in reactive memory, so a refresh silently closes every open document with no warning and no way back except reopening each one by hand.

LocationRole today
packages/ts/app-frame/app/composables/useDocumentTabs.ts:79-105DocumentTab state (key, stage, scopeItem, path, label, icon, hue, view) lives in an in-memory reactive store; nothing reads or writes it to any persistence backend
packages/ts/app-frame/app/composables/usePanePersistence.ts:44-54,236createLocalStoragePaneStore + usePanePersistence already solve this problem for pane width/collapse: JSON in localStorage, namespaced, swappable backend

The open-tabs list (key, stage, scopeItem, path, label, icon, hue, view) survives a full page reload, the same way pane-collapse state already does, using the same persistence-store pattern.

  1. Extract a DocumentTabsPersistenceStore interface mirroring PanePersistenceStore’s shape, with a localStorage-backed default.
  2. Snapshot the open-tabs list (excluding anything transient like drag state) and write it on change, namespaced per experience the same way experienceKeyFromPath scopes pane state.
  3. On mount, hydrate the tab strip from the stored snapshot before any document is opened by navigation, so a reload restores the same tabs in the same stage layout.
  4. Handle a stored tab whose underlying document no longer resolves (deleted or moved note) by dropping it silently rather than erroring.
AreaNote
packages/ts/app-frame/app/composables/useDocumentTabs.tsPersist and hydrate the open-tabs list
packages/ts/app-frame/app/composables/usePanePersistence.tsOnly if the store interface is generalized for reuse rather than duplicated
  • AC-1: Opening two documents, then reloading the page, restores both tabs with the same active tab.
  • AC-2: A stored tab pointing at a document that no longer exists is dropped on hydrate without an error.
  • AC-3: A unit test covers persist-then-hydrate round-tripping the tab list.
  • Persisting split-stage drag state or focus history beyond which tab is active.
  • none

Found by the agent-pants bug survey, N-5LD4-bug-sweep-2026-09-12-agent-pants (row AP-103).


← Back to Tasks