Skip to content

[Website] Flush Blueprint edits and suppress hidden editor focus - #4020

Closed
adamziel wants to merge 1 commit into
trunkfrom
dock-editor-lifecycle-prerequisites
Closed

[Website] Flush Blueprint edits and suppress hidden editor focus#4020
adamziel wants to merge 1 commit into
trunkfrom
dock-editor-lifecycle-prerequisites

Conversation

@adamziel

Copy link
Copy Markdown
Collaborator

What it does

Stops hidden file editors from taking focus after an asynchronous file open, and carries the latest Blueprint edit across editor teardown or Playground recreation.

Blueprint writes now use one queued filesystem wrapper per storage backend. A remounted editor waits for writes started by its predecessor before reading the same backend. This PR does not mount, restyle, or otherwise change the Dock UI from #4009.

Rationale

File-open callbacks restore CodeMirror focus after a short delay. When the editor becomes hidden before that callback finishes, the delayed focus previously moved keyboard focus away from the active surface.

Blueprint saves are debounced. If a parent unmounts immediately after a keystroke, the hook cleanup cancels the timer before the write starts. React cleanup cannot wait for that write, so a remounted editor could then read the same OPFS backend first and show stale Blueprint contents.

The editor now flushes the pending call during teardown and awaits it before recreating a Playground. Backend-scoped write serialization makes the teardown handoff safe: failed writes still reach their caller, while later reads and writes remain unblocked.

Testing instructions

npm exec nx test playground-website
npm exec nx run playground-components:e2e
npm exec nx run playground-website:typecheck
npm exec nx run playground-website:lint
npm exec nx run playground-components:lint
@adamziel

Copy link
Copy Markdown
Collaborator Author

Closing after re-auditing the actual Dock lifecycle. #4009 keeps visited editor surfaces mounted, and hidden file editors remain under hidden/display: none, so these defensive focus and remount abstractions are not Dock prerequisites. The Blueprint Run race will be handled separately with a direct reproduction and write-failure coverage.

@adamziel adamziel closed this Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment