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

Force saving a playground via Query API #2037

Closed
akirk opened this issue Nov 28, 2024 · 2 comments
Closed

Force saving a playground via Query API #2037

akirk opened this issue Nov 28, 2024 · 2 comments

Comments

@akirk
Copy link
Member

akirk commented Nov 28, 2024

With #1561, the ability to arbitrarily add a site-slug to the URL was removed. Thus, every new playground is a temporarily one and it has to be saved deliberately. What would be a way to ensure it is saved? A potential way to do this is to re-add site creation to the site-slug URL parameter. Or we could respond to a site-slug URL parameter to show a dialog like suggested in #2035 with the option to cancel.

brandonpayton added a commit that referenced this issue Dec 5, 2024
…#2059)

## Motivation for the change, related issues

We want to be able to address specific Playgrounds via slug, even if the
addressed Playground does not yet exist.

We'd rather not presume and store a Playground in a user's browser
storage without their consent, so as a compromise, we can prompt the
user and let them choose whether to store a site with the specified
slug.

Related to #2037 cc @akirk 

## Implementation details

This PR adds support for a `if-stored-site-missing=prompt` query param
that can be used alongside a `site-slug=<slug>` query param. If both
params are provided and a site with the specified slug does not exist,
we prompt the user and ask what they would like to do.

![Screenshot 2024-12-04 at 9 59
20 PM](https://github.com/user-attachments/assets/6f164297-8dbe-4b9a-8f84-bc3f29c947aa)

## Testing Instructions (or ideally a Blueprint)

- Run the dev server with `npm run dev`
- Visit
http://127.0.0.1:5400/website-server/?if-stored-site-missing=prompt&site-slug=speed-build-challenge
- Confirm the modal displays and test that each button does as expected

Note that when choosing to continue with the temporary site, it is
currently intentional that the original query params are not cleared.
The reason is that if we are wanting to target an specific,
possibly-non-existent slug, perhaps the user should be prompted with
each page refresh.

---------

Co-authored-by: Adam Zieliński <[email protected]>
Co-authored-by: Bero <[email protected]>
@brandonpayton
Copy link
Member

@akirk, is the following PR enough to resolve this issue?

@akirk
Copy link
Member Author

akirk commented Dec 5, 2024

It is enough, thank you so much!

@akirk akirk closed this as completed Dec 5, 2024
@github-project-automation github-project-automation bot moved this from Inbox to Done in Playground Board Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants