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

[Website] Use site slug as a stable scope #1839

Merged
merged 1 commit into from
Oct 4, 2024
Merged

[Website] Use site slug as a stable scope #1839

merged 1 commit into from
Oct 4, 2024

Conversation

adamziel
Copy link
Collaborator

@adamziel adamziel commented Oct 3, 2024

Change details

With this PR, Playground sites will use a stable path such as /scope:my-site-slug/ instead of a volatile, randomly generated one such as /scope:0.489625368/.

Motivation

WordPress stores URLs such as <img src=""> and <a href=""> in the post content in a raw form that includes the site path. However, Playground assigns each site a random one-time scope. This is a problem for persistent sites where you can upload an image today and have it referenced in a post as, say <img src="/scope:98742/wp-uploads/img.jpg"> and still expect to have it working correctly tomorrow when the site URL changes to /scope:1987578.

Testing instructions

  • Create a new site
  • Save it in the browser
  • Upload an image in a post
  • Save the post
  • Refresh the browser tab
  • Confirm that image still renders correctly
  • Do it again, but now upload that image before saving the site in the browser

With the introduction of multiple persistent Playgrounds, the users will get to interact with the same site multiple times

@adamziel adamziel force-pushed the trunk branch 2 times, most recently from 4b541aa to 680cd19 Compare October 4, 2024 09:22
@adamziel adamziel requested a review from a team as a code owner October 4, 2024 09:22
 ## Change details

With this PR, Playground sites will use a stable path such as `/scope:my-site-slug/`
instead of a volatile, randomly generated one such as `/scope:0.489625368/`.

 ## Motivation

WordPress stores URLs such as `<img src="">` and `<a href="">` in the
post content in a raw form that includes the site path. However,
Playground assigns each site a random one-time scope. This is a problem
for persistent sites where you can upload an image today and have it
referenced in a post as, say `<img src="/scope:98742/wp-uploads/img.jpg">`
and still expect to have it working correctly tomorrow when the site URL
changes to `/scope:1987578`.

 ## Testing instructions

* Create a new site
* Save it in the browser
* Upload an image in a post
* Save the post
* Refresh the browser tab
* Confirm that image still renders correctly
* Do it again, but now upload that image before saving the site in the
  browser

With the introduction of multiple persistent Playgrounds, the users will
get to interact with the same site multiple times
@adamziel adamziel merged commit 65f68ed into trunk Oct 4, 2024
6 of 9 checks passed
@adamziel adamziel deleted the named-scope branch October 4, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant