Skip to content

feat(desktop): restore last editing point after interruptions - #494

Open
teyepe wants to merge 5 commits into
shift-editor:mainfrom
teyepe:feat/restore-editing-point
Open

teyepe wants to merge 5 commits into
shift-editor:mainfrom
teyepe:feat/restore-editing-point

Conversation

@teyepe

@teyepe teyepe commented Oct 2, 2026 •

Copy link
Copy Markdown

Summary

  • Persist the last editor route and catalog view (query, category filters, language, scroll) per font session in view-resume.json, and restore it after preview conversion, crash or error reopen, relaunch recovery, and update restart.
  • Remap the open glyph by name, then unicode, after Save as Shift re-mints glyph ids. If no unique match exists, the route guard still falls back to Home with the catalog state restored.
  • Record open sessions only when restarting to install an update, so a normal quit never reopens documents.
  • A window that loads straight onto an editor route is now shown; previously it stayed hidden because the catalog only paints on Home.
  • Skip the pre-reopen view flush for a crashed renderer, which cannot answer it and stalled crash recovery.

Issue

Refs #492

Not closed by this PR: the Home fallback when a glyph cannot be remapped and the update-restart reopen are covered by unit tests only, with no E2E.

Follow-up found while testing: #493 (glyphs with extra UFO layers fail to open after Save as Shift).

Testing

Passed:

  • pnpm test (1231 desktop tests)
  • pnpm typecheck, pnpm --filter @shift/desktop lint:check, pnpm format:check
  • pnpm test:e2e:platform e2e/document-crash.spec.ts e2e/document-lifecycle.spec.ts e2e/document-recovery.spec.ts e2e/home.spec.ts e2e/glyph-grid.spec.ts e2e/application-quit.spec.ts --repeat-each=2: 99 passed, 1 failed. Run on a branch that also contained fix(desktop): keep New and Open commands enabled without active windows #491; unit tests and typecheck were rerun on this branch. The E2E specs were not rerun on this exact head
  • The one failure, the lifecycle test "preview canvas clicks explain restrictions while marquee stays selection-free", passed 6 of 6 when rerun alone with --grep "preview canvas clicks explain" --repeat-each=6. It looks like a load flake; I did not find a root cause.

New E2E: Save As restores the editor route after preview conversion; a crashed renderer reopens on the last editor route; relaunch recovery restores the last editor route.

Not run:

  • visual and gpu E2E projects. GlyphGrid.tsx changed, so e2e/home.spec.ts and e2e/glyph-grid.spec.ts are relevant.
  • --repeat-each=10 flake runs on the new specs.
  • Update-restart E2E; unit tests only.

teyepe added 5 commits October 3, 2026 00:12
Persist catalog and editor route state per session, transfer it on preview
conversion, compose workspace load hashes on reopen/recovery, and reopen
clean sessions after update restart when a save target exists.
The renderer used to take the saved view as soon as it asked for it, so a
restore that had to wait for the glyph catalog lost the payload. Split the
IPC into peek and consume so the renderer consumes only after restoring.

Also stop recording open sessions on every quit, which reopened documents
after a normal quit; record them only when restarting to install an update
and clear them if the restart is cancelled. Skip the pre-reopen view flush
for a crashed renderer, which cannot answer it and stalled crash recovery.
The route guard peeked at the saved view in the main process, and the next
capture rewrote it after the restore consumed it, so the guard deferred
forever and the editor never opened. Track the restore in the renderer,
restore only once, and publish the opened glyph even when an effect
rerun supersedes the request. Capture no longer overwrites a pending
route with an empty one before the catalog has loaded.
The window was presented once the catalog painted its first frame, but the
catalog only paints on Home, so a window loading straight onto an editor
route stayed hidden.
Preview Save As, crashed-renderer reopen, and relaunch recovery each land
on the last editor route. The conversion test opens glyph C because the
converted fixture cannot open glyphs whose second layer references a
dropped source. Relaunch recovery needs an unsaved edit to run at all.

This branch has not been deployed

No deployments
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