-
Notifications
You must be signed in to change notification settings - Fork 56
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
Avoid scroll on first load #169
Avoid scroll on first load #169
Conversation
@@ -55,6 +55,11 @@ export default Mixin.create({ | |||
const url = get(this, 'currentURL'); | |||
const hashElement = url ? document.getElementById(url.split('#').pop()) : null | |||
|
|||
if (get(this, 'service.isFirstLoad')) { | |||
get(this, 'service').unsetFirstLoad(); |
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.
So we are currently calling scrollTo
on first load here - however has no effect on first load for some reason on fast pages 🤷♂️. As detailed in the referenced issue, on first load, we should not try to scroll the page when we first enter the application. On slow requests, this does show up from time to time.
So using a flag isFirstLoad
, we can prevent unnecessary work.
https://github.com/dollarshaveclub/ember-router-scroll/blob/master/addon/index.js#L75
@snewcomer this looks more readable too. Would you mind adding a patch version bump? |
@yowainwright Patch for |
close #55