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

Scroll to top after first time revalidatePath() happens #74421

Open
CodingReaper1 opened this issue Dec 30, 2024 · 2 comments
Open

Scroll to top after first time revalidatePath() happens #74421

CodingReaper1 opened this issue Dec 30, 2024 · 2 comments
Labels
bug Issue was opened via the bug report template. Developer Experience Issues related to Next.js logs, Error overlay, etc.

Comments

@CodingReaper1
Copy link

CodingReaper1 commented Dec 30, 2024

Link to the code that reproduces this issue

https://github.com/CodingReaper1/TheWildOasisAdminNextJs

To Reproduce

  1. no need to start development server or to clone go to https://the-wild-oasis-admin-nextjs.vercel.app
  2. go to cabins page https://the-wild-oasis-admin-nextjs.vercel.app/cabins
  3. and whenever you do duplicate cabin or add or edit first time it scrolls to top which is caused by revalidatePath()

Current vs. Expected behavior

So I dont want it to scroll to top

further more if I add useOptimistic in all this first revalidatePath() will cause to scroll to top which im trying to fix right now without revalidatePath() optimistic update will be gone anyway

I do not have any code about useOptimistic in my github repo trying out in dev

this is happening both in production and dev

Provide environment information

I do not need to add env info I think becouse this is happening both in production and dev

Which area(s) are affected? (Select all that apply)

Developer Experience

Which stage(s) are affected? (Select all that apply)

next dev (local), next start (local), Vercel (Deployed)

Additional context

image
image
This is my current code in dev mode about useOptimistic

@CodingReaper1 CodingReaper1 added the bug Issue was opened via the bug report template. label Dec 30, 2024
@github-actions github-actions bot added the Developer Experience Issues related to Next.js logs, Error overlay, etc. label Dec 30, 2024
@CodingReaper1
Copy link
Author

Actually I added new branch useOptimistic as name you can check that out as well

@CodingReaper1
Copy link
Author

UPDATE I did some layout changes and this problem is magically fixed no longer scrolling up if anyones knows why please let me know im gonna leave this issue open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Developer Experience Issues related to Next.js logs, Error overlay, etc.
Projects
None yet
Development

No branches or pull requests

1 participant