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

Update demo URL with pushState() #4327

Merged
merged 7 commits into from
Sep 22, 2021
Merged

Conversation

Frenzie
Copy link
Contributor

@Frenzie Frenzie commented Sep 22, 2021

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

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (whenever applicable)
  • API or design changes are documented in API.md

That way people won't have to remember to copy the permalink.
@dylanjha
Copy link
Contributor

I'm in favor of this idea. Any maintainers opposed or see areas for potential confusion?

Copy link
Member

@tjenkinson tjenkinson left a 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.

demo/main.js Outdated Show resolved Hide resolved
demo/main.js Outdated Show resolved Hide resolved
Frenzie and others added 2 commits September 22, 2021 19:17
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;
Copy link
Member

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?

onDemoConfigChanged();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, if you prefer.

demo/main.js Outdated Show resolved Hide resolved
Copy link
Member

@tjenkinson tjenkinson left a 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

@tjenkinson tjenkinson merged commit 8c41dff into video-dev:master Sep 22, 2021
@Frenzie Frenzie deleted the pushstate branch September 23, 2021 06:14
@robwalch robwalch added this to the 1.0.11 milestone Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants