Skip to content

[Website] Update the fake address bar via setInterval() #2225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: merge-playground-private-2
Choose a base branch
from

Conversation

adamziel
Copy link
Collaborator

@ellatrix reported the URL is not getting updated when navigating through the site editor. One possible reason is the site editor uses the history.push() API which does not trigger the iframe load event.

This PR adds a proactive polling for URL changes via a setInterval() call.

Testing instructions

  1. Open Playground
  2. Go to the site editor
  3. Note the path in the address bar
  4. Click on the WordPress logo
  5. The path should change

@ellatrix reported the URL is not getting updated when navigating
through the site editor. One possible reason is the site editor uses
the `history.push()` API which does not trigger the iframe load event.

This PR adds a proactive polling for URL changes via a setInterval()
call.

 ## Testing instructions

1. Open Playground
2. Go to the site editor
3. Note the path in the address bar
4. Click on the WordPress logo
5. The path should change
@adamziel adamziel added [Type] Bug An existing feature does not function as intended [Aspect] Website labels May 30, 2025
@adamziel adamziel moved this from Inbox to In progress in Playground Board May 30, 2025
// * https://html.spec.whatwg.org/multipage/document-sequences.html#nav-active-history-entry
// * https://html.spec.whatwg.org/dev/browsing-the-web.html#centralized-modifications-of-session-history
let lastPath: string | undefined;
setInterval(async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should clear the interval after Playground is stopped.
Now, if you start with a temporary Playground, go to the Site Manager, and click on a Saved Playground, two interval loops will run in parallel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Aspect] Website [Type] Bug An existing feature does not function as intended
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

2 participants