-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Add ignoreScrollBehavior to new API #522
Conversation
68fbbfb
to
a505143
Compare
Just added the new tests. One last thing I'd like to do in this PR is to incorporate changes I made in #477. |
@gaearon This looks great! Thank you. I'll wait until you're ready to merge. |
Previously, the only way to opt out of scroll updates for a route would be by using `ignoreScrollBehavior`. This, however, made it hard to implement arguably the most common use case: resetting scroll when `params` change and preserving it when only `query` changes. This commit completely disables scroll updates when only `query` has changed. This provides a reasonable default behavior and leaves `ignoreScrollBehavior` for more complicated cases. If you'd rather keep the old behavior and reset scroll on query changes, you can either promote `query` variables to be route `params` or reset scroll position yourself in response to `query` changes in route handler's `componentDidUpdate`. Fixes remix-run#432, remix-run#439
83125d6
to
5fe6c08
Compare
@mjackson Consider this one ready. |
Let's hold this off for a moment. I think there's a bug in current RR scrolling code, I might fix it here as well. |
Nevermind, this code is fine. The issue I'm experiencing is unrelated so let's bring this in. |
Add ignoreScrollBehavior to new API
Thanks @gaearon ! @rpflorence Let's cut a new release with this stuff. 0.12? |
@gaearon By all means, be my guest ;) |
This PR exposes
ImitateBrowserBehavior
andScrollToTopBehavior
and reintroducesignoreScrollBehavior
which allows you to opt out of scrolling changes within bounds of some ancestor route.This was already implemented in #388 but it is missing in new API so I'm reimplementing it.
This PR adds test for
ScrollToTopBehavior
but lacks tests forignoreScrollBehavior
. I'll add these shortly.