Skip to content

Recover editor runtime after renderer full page reload #136

Description

@kostyafarber

Problem

The current HMR runtime work preserves editor state during React Fast Refresh, but Vite can still issue a full page reload for non-component dependency changes such as src/lib/keyboard/types.ts.

A full page reload destroys the renderer JavaScript realm. globalThis singletons, React providers, and renderer-local editor state cannot survive that boundary.

Distinction

Fast Refresh fixes and full reload recovery are different problems:

  • Fast Refresh: preserve one renderer JS realm; split provider/context exports; keep React as a view shell.
  • Full page reload: recreate the renderer page and reconnect to durable state owned elsewhere, or reconstruct session state from a saved snapshot.

Direction

Treat full reload as a renderer recovery path:

  • Avoid avoidable reloads by keeping provider modules Fast Refresh-safe and local @shift/* packages out of stale Vite prebundles.
  • Reconnect the renderer to the existing utility workspace session after reload.
  • Reconstruct at least the route glyph scene so the canvas does not blank.
  • Later, consider session-scoped records for scene nodes, selection, editing state, and tool state.

Acceptance criteria

  • Editing a dependency that causes Vite page reload reconnects to the existing workspace session.
  • The editor route reconstructs the current glyph scene after reload.
  • Canvas surfaces reattach without requiring a full app restart.
  • The HMR ticket clearly distinguishes Fast Refresh from full reload recovery.

Obsidian context: hmr-editor-runtime-ticket.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions