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

Don't scroll on initial load #263

Open
lolmaus opened this issue Nov 10, 2020 · 3 comments
Open

Don't scroll on initial load #263

lolmaus opened this issue Nov 10, 2020 · 3 comments

Comments

@lolmaus
Copy link

lolmaus commented Nov 10, 2020

Hi, thanks for the great addon!

With FastBoot, the user is able to scroll down the static HTML version of the app.

When the app rehydrates, ember-router-scroll resets scrolling, producing jerky behavior.

@lolmaus
Copy link
Author

lolmaus commented Nov 10, 2020

I've found the isFirstLoad property. It is read here, but it does not set up to prevent scrolling:

if (get(this, 'service.isFirstLoad')) {
get(this, 'service').unsetFirstLoad();
}

@lolmaus
Copy link
Author

lolmaus commented Nov 10, 2020

This ugly hack resolves the issue for me:

    this.routerScroll.set('preserveScrollPosition', true);

    later(this, function () {
        this.routerScroll.set('preserveScrollPosition', false);
    }, 1000);

...in application route's beforeModel hook.

@snewcomer
Copy link
Collaborator

@lolmaus 👍 Do you see an improvement that could be added here? Thx for the issue btw!

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

No branches or pull requests

2 participants