Skip to content

[Website] Save pending Blueprint edits before Run - #4022

Merged
adamziel merged 5 commits into
trunkfrom
blueprint-run-latest-edit
Jul 11, 2026
Merged

[Website] Save pending Blueprint edits before Run#4022
adamziel merged 5 commits into
trunkfrom
blueprint-run-latest-edit

Conversation

@adamziel

@adamziel adamziel commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

What it does

Flushes the current debounced Blueprint save before Run Blueprint, waits for
that write and any earlier editor write, and leaves the current Playground
untouched when the save fails.

useDebouncedCallback returned value now provides a .flush() call for manually calling the debounced function.

Rationale

Blueprint saves wait for a 200 ms debounce. Run previously resolved the bundle
immediately, so a quick edit followed by Run could recreate the Playground from
the previous blueprint.json contents.

Testing

npm exec nx test playground-website -- --testFile=BlueprintBundleEditor.spec.tsx
npm exec nx test playground-website
npm exec nx run playground-website:typecheck
npm exec nx run playground-website:lint

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds a write-ordering and flush barrier so Run Blueprint waits for pending debounced editor saves (and retries failed saves) before recreating the Playground, preventing runtime resolution from using stale filesystem content.

Changes:

  • Extend useDebouncedCallback to expose a flush() method for forcing the latest pending call to run immediately.
  • Add an ordered save queue plus failed-save tracking in BlueprintBundleEditor, and block recreation when unsaved edits remain.
  • Add Vitest coverage validating flush + in-flight write barriers and retry behavior across navigation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/playground/website/src/lib/hooks/use-debounced-callback.ts Adds a debounced callback type with flush() support.
packages/playground/website/src/components/blueprint-editor/BlueprintBundleEditor.tsx Implements ordered save queue + retry-on-run logic and disables editing during recreation.
packages/playground/website/src/components/blueprint-editor/BlueprintBundleEditor.spec.tsx Adds tests ensuring pending saves complete (or block) before runtime resolution and recreation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/playground/website/src/lib/hooks/use-debounced-callback.ts
@adamziel
adamziel merged commit 4afcacc into trunk Jul 11, 2026
53 checks passed
@adamziel
adamziel deleted the blueprint-run-latest-edit branch July 11, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment