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.
| Location | Role today |
|---|---|
packages/ts/app-frame/app/composables/useDocumentTabs.ts:79-105 | DocumentTab 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,236 | createLocalStoragePaneStore + usePanePersistence already solve this problem for pane width/collapse: JSON in localStorage, namespaced, swappable backend |
Proposed
Section titled “Proposed”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.
Approach
Section titled “Approach”- Extract a
DocumentTabsPersistenceStoreinterface mirroringPanePersistenceStore’s shape, with alocalStorage-backed default. - Snapshot the open-tabs list (excluding anything transient like drag
state) and write it on change, namespaced per experience the same
way
experienceKeyFromPathscopes pane state. - 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.
- Handle a stored tab whose underlying document no longer resolves (deleted or moved note) by dropping it silently rather than erroring.
| Area | Note |
|---|---|
packages/ts/app-frame/app/composables/useDocumentTabs.ts | Persist and hydrate the open-tabs list |
packages/ts/app-frame/app/composables/usePanePersistence.ts | Only if the store interface is generalized for reuse rather than duplicated |
Acceptance criteria
Section titled “Acceptance criteria”- 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.
Out of scope
Section titled “Out of scope”- Persisting split-stage drag state or focus history beyond which tab is active.
Dependencies
Section titled “Dependencies”- none
Discovery context
Section titled “Discovery context”Found by the agent-pants bug survey, N-5LD4-bug-sweep-2026-09-12-agent-pants (row AP-103).