Skip to content

fix(frontend): persist rail expanded/collapsed state across navigation - #148

Merged
mhersson merged 1 commit into
mainfrom
ctxmax-639/the-status-of-the-rail-should-be-remembered
May 25, 2026
Merged

fix(frontend): persist rail expanded/collapsed state across navigation#148
mhersson merged 1 commit into
mainfrom
ctxmax-639/the-status-of-the-rail-should-be-remembered

Conversation

@contextmatrix-runner

Copy link
Copy Markdown
Contributor

Summary

Fixes a bug where the CardPanel right rail's expanded/collapsed state was reset whenever the user navigated away from the board (e.g. to /chat or /all) and came back.

  • Adds safeReadRail() / safeWriteRail() helpers with try/catch to handle private-mode gracefully
  • Initializes railExpanded from localStorage (contextmatrix-rail-expanded) with isHITLRunning as fallback
  • Wraps setRailExpanded to persist every user toggle to localStorage
  • HITL auto-expand override still works — when a HITL session starts the rail expands regardless of stored value
  • Updates web/CLAUDE.md localStorage allowlist to include the new key

Follow-up polish items (useCallback stability, redundant read, stale CLAUDE.md prose, explicit test isolation) tracked in CTXMAX-641.

Test plan

  • Open a card, expand the rail, navigate to /chat, navigate back — rail stays open
  • Open a card, collapse the rail, navigate away and back — rail stays closed
  • Page reload with rail open — rail stays open
  • Open a card with active HITL run — rail auto-expands regardless of stored value
  • All Go tests pass (go test ./internal/...)
  • 670 frontend tests pass

- Add safeReadRail/safeWriteRail helpers with try/catch for private browsing
- Initialize railExpanded with lazy useState: safeReadRail() ?? isHITLRunning
- Wrap setRailExpanded to persist every change to localStorage
- On card-identity change: restore from localStorage instead of resetting to isHITLRunning
- On HITL flip-on: persist forced-expand to localStorage via safeWriteRail(true)
- Update web/CLAUDE.md localStorage allowlist with contextmatrix-rail-expanded key
@mhersson
mhersson merged commit ec9332d into main May 25, 2026
6 of 7 checks passed
@mhersson
mhersson deleted the ctxmax-639/the-status-of-the-rail-should-be-remembered branch May 25, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant