Skip to content

[Website] Bind copied Blueprint bundles to their new Playground - #4115

Merged
adamziel merged 1 commit into
trunkfrom
copied-blueprint-bundle-ownership
Jul 20, 2026
Merged

[Website] Bind copied Blueprint bundles to their new Playground#4115
adamziel merged 1 commit into
trunkfrom
copied-blueprint-bundle-ownership

Conversation

@adamziel

@adamziel adamziel commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Part of #4099.

Stored Playgrounds created from editable Blueprint bundles kept the source bundle backend in their metadata until the page reloaded. Editing the new Playground during the same session could therefore modify the source Playground's Blueprint.

persistBlueprintBundle() now returns the destination OPFS backend after copying the bundle, and createStoredSite() records that backend in the new site's metadata. The bundle is still written before the site record.

Testing

Run a stored Playground's Blueprint, edit the new Playground before reloading, then return to the source Playground and confirm its Blueprint did not change.

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 ensures that when a stored Playground is created from an editable Blueprint bundle, the newly created Playground immediately references its own copied bundle backend (under the destination slug), preventing edits from mutating the source Playground’s draft before a reload.

Changes:

  • Load the persisted Blueprint bundle backend for the destination slug and store it in the new site’s metadata.
  • Update tests to mock and assert the new loadPersistedBlueprintBundle() behavior.
  • Clarify the code comment to describe the “copy then bind” behavior.

Reviewed changes

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

File Description
packages/playground/website/src/lib/state/redux/slice-sites.ts Load the destination-slug persisted bundle backend before writing site metadata so the new Playground owns its copied bundle immediately.
packages/playground/website/src/lib/state/redux/slice-sites.spec.ts Update mocks/expectations to validate the new persisted-bundle load step and metadata binding.

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

Comment thread packages/playground/website/src/lib/state/redux/slice-sites.ts
Comment thread packages/playground/website/src/lib/state/redux/slice-sites.ts Outdated
A stored site created from an editable Blueprint copies the bundle into the
new slug, but kept the source backend in metadata until reload. Editing the
new Playground in the same session could still write to the source bundle.

Return the destination backend from persistBlueprintBundle and store it in
the new site's metadata. This avoids reopening the OPFS directory and keeps
the bundle write ordered before the site record.
@adamziel
adamziel force-pushed the copied-blueprint-bundle-ownership branch from 6a53b15 to 358ab61 Compare July 20, 2026 14:20
@adamziel
adamziel merged commit 88631c7 into trunk Jul 20, 2026
53 checks passed
@adamziel
adamziel deleted the copied-blueprint-bundle-ownership branch July 20, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment