Skip to content
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

[Blueprints] Make landingPage handling runtime-specific and move it to PlaygroundViewport #1916

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

adamziel
Copy link
Collaborator

@adamziel adamziel commented Oct 16, 2024

Moves the playground.goTo(blueprint.landingPage) call from the compile() method to the PlaygroundViewport component to:

  • Support ?url=/wp-admin/ on OPFS sites, not just on the temporary sites
  • Stop using that browser-specific goTo method in all Blueprints. It sets iframe.src which is browser-specific. .goTo() is not available in, say, Playground CLI or Studio. Those runtimes would need their own handlers to support the landing page.

Remaining work

  • Add E2E tests
  • Explain more context and why this cannot be easily supported in compile()

Testing instructions

For temporary sites:

For stored sites:

  • Create a local Playground site
  • Store it in OPFS
  • Add ?url=/wp-admin/ and visit it
  • Confirm you're redirected to WP Admin and the url parameter is removed from the address bar

cc @akirk @brandonpayton @bgrgicak

…o PlaygroundViewport

Goals:

* Enable using ?url=/wp-admin/ on sites stored in OPFS
* Don't rely on `goTo` at the Blueprints library level as that method
  is browser-specific. It sets iframe.src. It is not available in,
  say, Playground CLI or Studio. Those would have to implement their own
  ways of handling the landing page.

 ## Remaining work

* Add E2E tests

 ## Testing instructions

For temporary sites:

* Go to http://localhost:5400/website-server/?url=/wp-admin/
* Confirm you're redirected to WP admin adn the `url` parameter is still
  present in the address bar

For stored sites:

* Create a local Playground site
* Store it in OPFS
* Add `?url=/wp-admin/` and visit it
* Confirm you're redirected to WP Admin and the `url` parameter is
  removed from the address bar
Copy link
Collaborator

@bgrgicak bgrgicak left a comment

Choose a reason for hiding this comment

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

It works as described.

Why are we removing URL parameters?
As a user, I find it confusing that hitting refresh doesn't get me to the same page I started with.

@adamziel adamziel self-assigned this Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Reviewed
Development

Successfully merging this pull request may close these issues.

2 participants