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

Requires a loader #9

Open
OliverJAsh opened this issue Aug 20, 2024 · 4 comments
Open

Requires a loader #9

OliverJAsh opened this issue Aug 20, 2024 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@OliverJAsh
Copy link

OliverJAsh commented Aug 20, 2024

If I understand correctly, this will update positions when the navigation state is not idle, e.g. when it's loading. This will only happen if the next route has a loader.

Here's a reduced test case to illustrate the problem: https://stackblitz.com/edit/github-eve2dr-vm34va?file=src%2Fapp.tsx

What are your thoughts on updating this to save the scroll position even when navigating to a route that doesn't have a loader?

@OliverJAsh
Copy link
Author

On a related note, I also noticed that it doesn't work when v7_startTransition is enabled. This is because useNavigation().state is always idle.

https://stackblitz.com/edit/github-eve2dr-glrg3x?file=src%2Fapp.tsx

@kentcdodds
Copy link
Member

@brophdawg11, do you think React Router could publish an official version of this so we don't have to try to integrate from the outside? It's proving to be a challenge.

@brophdawg11
Copy link

I'll check with Ryan and Michael on their appetite for inlining! I do think that a foolproof solution to this likely requires access to router internals for this specific no-loader case, and also for more advanced preventScrollReset behaviors - see remix-run/react-router#10468 (comment).

That community PR was only for changing the scroll container, not supporting multiple scroll containers - so maybe this package addresses the shortcoming that stalled out that PR.

@kentcdodds
Copy link
Member

kentcdodds commented Aug 20, 2024

Thanks @brophdawg11!

In the mean time @OliverJAsh, I'm afraid I only have the bandwidth to address issues that are impacting me and my own work at the time. I'm happy to look at a PR though.

@kentcdodds kentcdodds added the help wanted Extra attention is needed label Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants