-
Notifications
You must be signed in to change notification settings - Fork 274
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
Support users choosing how to handle URLs for sites that do not exist #2059
Support users choosing how to handle URLs for sites that do not exist #2059
Conversation
Please feel free to adjust the language or tweak the behavior here. One thing that would be good to adjust yet is to wait for the temporary site to load before displaying the modal. Otherwise, the modal will show before it is usable and also obscure the progress indicator. |
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brandonpayton I left a few suggestions.
Let's also make sure we document this before merging the PR.
...yground/website/src/components/ensure-playground-site/ensure-playground-site-is-selected.tsx
Outdated
Show resolved
Hide resolved
packages/playground/website/src/components/missing-site-modal/index.tsx
Outdated
Show resolved
Hide resolved
packages/playground/website/src/components/missing-site-modal/index.tsx
Outdated
Show resolved
Hide resolved
const promptIfSiteMissing = | ||
url.searchParams.get('if-stored-site-missing') === 'prompt'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this extra query argument? Is there any harm in just prompting the user by default?
As a user, I prefer fewer query arguments to remember and type. Also, showing the modal is a reasonable default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without that parameter, users will see the modal if they delete one of their Playgrounds and then visit a stale ?slug=
link in from their browser history. The extra param ensures the modal is only visible when consent was the intention in the first place.
…index.tsx Co-authored-by: Bero <[email protected]>
…index.tsx Co-authored-by: Bero <[email protected]>
…ite/ensure-playground-site-is-selected.tsx Co-authored-by: Bero <[email protected]>
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 asite-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.Testing Instructions (or ideally a Blueprint)
npm run dev
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.