Skip to content

[Website] Ask before reloading edited Blueprint fragments - #4089

Merged
adamziel merged 3 commits into
WordPress:trunkfrom
articles-adamziel-com:adamziel/confirm-fragment-reload
Jul 16, 2026
Merged

[Website] Ask before reloading edited Blueprint fragments#4089
adamziel merged 3 commits into
WordPress:trunkfrom
articles-adamziel-com:adamziel/confirm-fragment-reload

Conversation

@adamziel

@adamziel adamziel commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Changing or removing a Blueprint fragment now asks whether to reload. Without a reload, the address bar can describe a different Blueprint than the running Playground.

Blueprint fragments are read when Playground boots. Before this PR, editing or removing the fragment changed the URL but did nothing to the running instance. Accepting the browser prompt now reloads the page. A replacement fragment boots its Blueprint; removing the fragment boots without a URL Blueprint. Canceling restores the previous URL.

Screencast:

fragment-confirm.mp4

Testing

Open Playground with a Blueprint fragment and replace it with another encoded Blueprint. Cancel and check that the previous URL returns. Repeat and accept to check that the new Blueprint loads. Then remove the fragment and check that accepting the prompt reloads without a URL Blueprint.

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.

Adds a hashchange confirmation flow so that changing the Blueprint fragment in the URL prompts the user to reload (to boot the new Blueprint) or reverts the URL (to keep the current running Playground consistent).

Changes:

  • Introduces confirmReloadWithNewBlueprint to intercept hash-only URL changes and either reload or restore the previous URL.
  • Adds a one-time global hashchange listener guarded by a Symbol.for(...) patch key.
  • Adds unit tests covering accept/decline flows and ignoring hash removal.

Reviewed changes

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

File Description
packages/playground/website/src/lib/state/url/router-hooks.ts Adds hashchange interception + confirmation/revert logic for Blueprint fragment changes.
packages/playground/website/src/lib/state/url/router-hooks.spec.ts Adds tests for the new hashchange confirmation behavior.

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

Comment thread packages/playground/website/src/lib/state/url/router-hooks.ts
Comment thread packages/playground/website/src/lib/state/url/router-hooks.ts Outdated
Comment thread packages/playground/website/src/lib/state/url/router-hooks.spec.ts Outdated
@adamziel
adamziel merged commit 92c3427 into WordPress:trunk Jul 16, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment