Skip to content

[Website] Preserve concurrent metadata while preparing Blueprint drafts - #4116

Merged
adamziel merged 1 commit into
trunkfrom
blueprint-draft-metadata-update
Jul 20, 2026
Merged

[Website] Preserve concurrent metadata while preparing Blueprint drafts#4116
adamziel merged 1 commit into
trunkfrom
blueprint-draft-metadata-update

Conversation

@adamziel

@adamziel adamziel commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Part of #4099.

Opening the Blueprint editor while an autosaved Playground is still copying its WordPress files into OPFS could put the Playground back into a pending state.

The editor stored its Blueprint bundle asynchronously, then wrote the entire site metadata snapshot captured before that work started. If boot cleared initialOpfsSyncPending in the meantime, this stale write restored it.

Update only originalBlueprint and originalBlueprintSource after storing the bundle. Boot and synchronization metadata is left alone.

Testing

Open the Blueprint editor for a newly created autosaved Playground while its initial save completes. Reload and confirm it opens from its stored files.

@adamziel
adamziel force-pushed the copied-blueprint-bundle-ownership branch from 6a53b15 to 358ab61 Compare July 20, 2026 14:20
Base automatically changed from copied-blueprint-bundle-ownership to trunk July 20, 2026 14:38
@adamziel
adamziel force-pushed the blueprint-draft-metadata-update branch from 45c20c4 to 2e9a637 Compare July 20, 2026 14:41
@adamziel
adamziel marked this pull request as ready for review July 20, 2026 14:42
@adamziel
adamziel requested review from a team, brandonpayton and Copilot July 20, 2026 14:42

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.

Fixes a race where opening the Blueprint editor during an autosave OPFS copy could restore stale site metadata (e.g., re-setting initialOpfsSyncPending) by only writing the Blueprint-related metadata after the bundle is persisted.

Changes:

  • Swap from writing a full metadata snapshot to updating only originalBlueprint / originalBlueprintSource after persisting the bundle.
  • Simplify OPFS blueprint bundle loading by using the persisted backend directly.
  • Add a component-level test to ensure only Blueprint metadata is updated after persistence completes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
packages/playground/website/src/components/blueprint-editor/SiteBlueprintBundleEditor.tsx Avoids stale metadata writes by dispatching a targeted metadata update after bundle persistence.
packages/playground/website/src/components/blueprint-editor/SiteBlueprintBundleEditor.spec.ts Adds coverage for the race condition by asserting metadata updates happen only after persistence resolves.

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

Autosaved sites migrate declaration-only Blueprints to an OPFS draft in an
async effect. The effect spread the SiteInfo snapshot it started with back
into Redux after I/O. A boot or sync that updated metadata in the meantime
could have its changes reverted.

Use the backend returned by persistBlueprintBundle and update only
originalBlueprint and originalBlueprintSource. Lifecycle metadata is left
alone.
@adamziel
adamziel force-pushed the blueprint-draft-metadata-update branch from 2e9a637 to 0cf2d08 Compare July 20, 2026 14:44
@adamziel
adamziel merged commit 2238f91 into trunk Jul 20, 2026
53 checks passed
@adamziel
adamziel deleted the blueprint-draft-metadata-update branch July 20, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment