feat(desktop): reopen documents on their last glyph after interruptions - #495
Merged
Merged
Conversation
A reopened crashed window loads the editor route the old window showed. Source glyph IDs are now derived from the canonical source path and glyph name, so a preview and the document converted from it agree on every ID and the route survives conversion without remapping. Glyphs created while editing still get random IDs.
…update Documents open when Shift stops without an ordinary quit now reopen on the next launch, as in macOS document apps: a crash, forced termination or update restart restores them, while Cmd+Q starts fresh. Recent documents carry an open mark that only an ordinary quit or closing the document clears. Each reopened window, including crash reopen, returns to the glyph it last showed. The renderer remembers that per document in localStorage, since view state is personal and never belongs in the .shift file, and restores it only when main loads the window with the resume flag, so ordinary opens still land on Home.
kostyafarber
commented
Oct 3, 2026
Collaborator
Author
|
cc @teyepe this should restore windows with your opened glyphs in various scenarios, crashing/restarts/updates/saving, i'm gonna open another PR for camera and viewport and any home state (search queries, filters etc). |
…t views before kills
A UFO's background and support layers import as layer sources, which the editor does not model, but glyph records still listed their layers. The editor could not resolve those sources and failed to open the glyph. Glyph records now list only layers on master sources, matching the sources the editor sees; the other layers stay in the document. Closes #493
Font::masters and Font::master_layers now define the sources and layers the editor works with. The bridge reads sources, glyph records, and glyph snapshots through them, so the renderer can no longer receive a layer whose source it was not given. Snapshots also stop sending state for background and support layers the editor never attaches.
This was referenced Oct 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SourceGlyphIds), so a preview and the document converted from it agree on every ID. Glyphs created while editing still get random IDs.A,B,E, … in MutatorSans) now open. Glyph records sent to the editor list only layers on master sources, matchinggetSources(); the other layers stay in the document. Before this, conversion bounced to Home, which hid the bug.RecentDocuments. Only an ordinary quit (AppLifecycle.quitReason === "quit") or closing the document clears it.#/home?resume.DocumentViews, keyed byDocumentIdor the untitled workspace) and restores it only when it seesresume. View state is personal, so it never goes into the.shiftfile.Issue
Refs #492
Closes #493
Not covered here: catalog query, filters, language and scroll, and the editor camera. Those come in a follow-up as more fields on
DocumentView.Testing
Passed:
pnpm typecheck,pnpm lint:check,pnpm format:check,node scripts/check-e2e-projects.mjspnpm --filter @shift/desktop test(1226 tests), including the newWorkspaceHosttest that converts a preview against the native bridge and asserts every glyph keeps its IDcargo test -p shift-font -p shift-backends -p shift-workspace,cargo clippy,cargo fmtNot run locally (left to CI):
document-crash.spec.ts: a crashed renderer reopens on its glyph.document-recovery.spec.ts: a clean document reopens on its glyph after forced termination.document-lifecycle.spec.ts: "Save As keeps a preview glyph route in the new workspace" replaces the old test that expected conversion to bounce to Home.application-quit.spec.ts(the signal-kill tests now go through the reopen path),document-recovery.spec.ts,variable-font-recovery.spec.ts.AppLifecycle.quitReasonand the recents open mark). No N → N+1 installed-build check.🤖 Generated with Claude Code