Skip to content

[Bug]: scroll reset to top when fetcher.submit or submit from useSubmit #9837

Closed Answered by hasunpark
hasunpark asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, i solve this problem. I thought it was bug, but i found the code that make this problem

// root.tsx
...
const params = useParams();

  useEffect(() => {
    window.scrollTo({
      top: 0,
      // behavior: "smooth"
    });
  }, [params]);
...

my coworker wrote this code to reset position when navigate, but it cause the side effect(after submit position reset), so if there are somebody having trouble like me, have a look for your component tree :)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hasunpark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
1 participant
Converted from issue

This discussion was converted from issue #9834 on January 09, 2023 06:29.