Editor selected-path state doesn't survive navigation back to Workspace — selectedPathId is local useState, the right panel re-renders with no selection on remount #162
Labels
No labels
blocked:commit-ready-failed
blocked:gate-fetch
blocked:gate-lint
blocked:gate-plan
blocked:gate-research
blocked:needs-attention
blocked:needs-decision
blocked:needs-human
blocked:no-changes
blocked:verify-failed
bug
deferred
feature-request
in-progress
needs-decompose
needs-triage
quickfix
security/medium
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/Kimi_Agent_Brother_10_Digitizing_App#162
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Finding
The Editor (
src/pages/Editor.tsx:175) holds the currently-selected path in a localuseState:When the user navigates from the Editor to the Workspace (via "Back to Workspace") and back to the Editor, the React tree unmounts and the state is gone. The Editor re-hydrates
pathsfromsessionStorage(per #110) but the selection is local state — never persisted.The user picks a path, edits it, navigates away, comes back, finds no selection. The right panel shows "No nodes selected". The user has to re-click the path.
Where
src/pages/Editor.tsx:175—const [selectedPathId, setSelectedPathId] = useState<string | null>(null);Suggested fix shape
Persist
selectedPathIdinsessionStorage(next to the paths snapshot at line 188-210). On mount, read it back. On unmount/navigation, leave it. The Editor's existing sessionStorage write effect can includeselectedPathIdin the payload:The load effect on mount reads the same shape and sets the state.
Alternative: pass
selectedPathIdthrough the existing #110 round-trip bridge (Editor → sessionStorage → Workspace re-hydration) by extending the snapshot payload'sdesignSettingsfield. Workspace doesn't need to use the value, but the Editor's mount reads it from the same key.Severity
Low. Quality-of-life: the user re-clicks the path. The state is functionally correct after the re-click.
Discovered by
Gap analysis (2026-10-02) of editor state persistence.
Related
Fixed in
6c12c23on main.Editor now persists
selectedPathIdthrough the existing #110/#152 sessionStorage bridge (added todesignSettings) and reads it back on mount via a newloadInitialSelectedPathIdhelper — mirroring the pattern already used forfilename. Navigating Editor → Workspace → Editor restores the user's last selection instead of resetting to 'No nodes selected'.TypeScript clean, vitest 706/706 pass.