-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Page scrolled back to the top when redirecting to same the page from useFetcher Form #3145
Comments
Do you have the |
I do which is what's causing it, I'm just not sure that it's the right behaviour |
Hmm.. interesting. Since you're using |
This is for JS/non-JS support where I'm using the same action. In the non-JS version I want a redirect whereas in the JS version I want to stay on the same page, the logic is close the the Newsletter Sign Up example. As far as I'm aware useFetcher will redirect if it recieves a redirect response but I don't think it should if you're on the same page. By the looks of it this is the funcionality of a normal I could write some custom logic to only return a redirect if I provide a certain field but that feels messy. |
I've added a PR which fixes the problem for me but I don't know if it's what the Remix team will want. Also fixed the PR to use my actual personal account and not my work one :( |
@kiliman is correct in that a fetcher redirecting is a new location so it will cause scroll position to be reset. We recently added Once we fix that, |
This should be fixed in Remix 1.12.0 which should be deployed in the next hour or two |
Released in 1.12.0 |
What version of Remix are you using?
1.4.1
Steps to Reproduce
Submit a form from useFetcher
Expected Behavior
Page should stay at the same scroll position
Actual Behavior
Page is scrolled to the top
The text was updated successfully, but these errors were encountered: