Skip to content

Restore the last opened file and editor mode on refresh - #22

Merged
DebelToni merged 1 commit into
mainfrom
fix/restore-workspace-source
Oct 31, 2026
Merged

DebelToni merged 1 commit into
mainfrom
fix/restore-workspace-source

Conversation

@DebelToni

Copy link
Copy Markdown
Owner

Summary

  • Remember the last successfully opened file and Manuscript/Files mode in browser local storage, scoped to the signed-in account and project.
  • Restore by stable file ID so renames work; use the existing default/first-file fallback if the saved file was deleted.
  • Ignore malformed or unavailable browser storage without interrupting navigation.

Verification

  • Reproduced the refresh bug with remount regression tests before the fix.
  • Added coverage for both modes, renamed/deleted files, failed navigation, account/project isolation, and corrupt/blocked storage.
  • pnpm check passed (lint, typecheck, full tests, production build).
  • pnpm test:compiler passed with real Docker.
  • Local Node 26 verification used NODE_OPTIONS=--no-experimental-webstorage so jsdom owns test localStorage.

No server, production data, deployment configuration, or host automation changes.

@DebelToni DebelToni left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the complete four-file diff at bbc81bb against current main 3c0da06. No blocking findings.

Source preference stores only file ID/mode under an unambiguous account/project key. Restore selects an ID from the current authorized file list before fetching it, preserving rename behavior and falling back to the existing default/first-file choice after deletion. Persistence follows committed selection/mode state after initial loading; failed navigation does not replace the previous preference. Reviewed the surrounding navigation guards and session/route lifecycle. New helpers handle malformed or unavailable storage without making storage authoritative for file access.

Regression tests cover both modes across remount, stable IDs after rename, deletion fallback and its persistence, failed selection, account/project key isolation and malformed/blocked storage at the helper boundary. No server/API/permission, credential/content storage, dependency/workflow, deployment or host-automation changes. Exact-head hosted test/analyze and CodeQL passed. No contributor code, tests, installers or builds executed on DGX; no independent browser refresh test is claimed.

@DebelToni
DebelToni merged commit 64913d0 into main Oct 31, 2026
3 checks passed
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