-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Update demo URL with pushState() #4327
Conversation
That way people won't have to remember to copy the permalink.
I'm in favor of this idea. Any maintainers opposed or see areas for potential confusion? |
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.
Looks great, but please could you update it so that the url isn't written for the initial load (without any query params)?
At the moment it causes a new back entry that behaves like an instant redirect when you load the page the first time. Also I think for the default config, it might be better to not bake that in unless the user specifically wants to share a url with the (current) default config.
Co-authored-by: Tom Jenkinson <tjenkinson@users.noreply.github.com>
We can't just check if we're on baseURL, because then it'd never activate. I don't immediately see a better method, give or take perhaps where you set the variables.
demo/main.js
Outdated
@@ -1459,6 +1462,7 @@ function getURLParam(sParam, defaultValue) { | |||
return defaultValue; | |||
} | |||
|
|||
let firstLoad = true; |
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.
This works but I think it would be a bit nicer without the global variable. Maybe onDemoChanged
could take a firstLoad
param instead, and then this would be true
when called here?
Line 340 in c8340b8
onDemoConfigChanged(); |
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.
Sure, if you prefer.
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.
Thanks! will check the netlify page when it's built and then merge
That way people won't have to remember to copy the permalink. Also you can go back to a previous configuration by pressing the back button.
This PR will...
Make it so the URL in the addressbar is the same as the permalink on the page.
Why is this Pull Request needed?
It's happened more than once that someone sent me the link to have to do it again. ;-)
Are there any points in the code the reviewer needs to double check?
Resolves issues:
Checklist