-
Notifications
You must be signed in to change notification settings - Fork 2.7k
ScrollRestoration on RR 6.4 #4844
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
ScrollRestoration on RR 6.4 #4844
Conversation
|
| export function useBeforeUnload( | ||
| callback: (event: BeforeUnloadEvent) => any | ||
| ): void { | ||
| // TODO: Export from react-router-dom |
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.
✅
| import type { ScrollRestorationProps as ScrollRestorationPropsRR } from "react-router-dom"; | ||
| import { | ||
| useLocation, | ||
| UNSAFE_useScrollRestoration as useScrollRestoration, |
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.
The hook was private in both Remix and RR so kept it that way via the UNSAFE_ prefix
| useScrollRestoration({ | ||
| getKey, | ||
| storageKey: STORAGE_KEY, | ||
| skip: !hydrated, |
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.
Matt to do some double checking here and see if there's any way skip could go away...
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.
If we assume hydrationData means "skip the first restoration" then we could get rid of this
691c7c9 to
6ed9f3f
Compare
09e580a to
8fa967f
Compare
8fa967f to
47ca3bb
Compare
* Bump remix to [email protected] (#4668) * RRR Step 2 - Server Rendering (#4669) * RRR Step 3 - Hydration (#4703) * RRR Rendering Follow Ups (#4885) * ScrollRestoration on RR 6.4 (#4844) Co-authored-by: Jacob Ebey <[email protected]>
Update to
ScrollRestorationto wrap the RR 6.4 internalsTesting:
Needs to be run with changes from Updates for Remix on RR 6.4 react-router#9664<ScrollRestoration getKey={(location, matches) => ...} />works<Link preventScrollReset>works