Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

router.push with { scroll: false } still scrolls to top when using loading.tsx in production #84423

Labels
Loading UI and StreamingRelated to loading UI (loading.tsx) and streaming.
@GlebKodrik

Description

@GlebKodrik

Link to the code that reproduces this issue

https://github.com/GlebKodrik/nextjs-bug

To Reproduce

  1. Clone the repo and install dependencies.
  2. Run the app in development mode: npm run dev.
  3. Scroll to the bottom of the page — you will see two buttons: Intensive and Check.
  4. Click either button → navigation happens via:
router.push(`?${params.toString()}`, { scroll: false })
  • In development mode, the page does not scroll to top.
  1. Build and start the app in production:
next buildnext start
  1. Scroll to the bottom and click either button again → the page jumps to top unexpectedly.

⚠️ Important:

  • Removing loading.tsx prevents the scroll jump.
  • Adding loading.tsx triggers the scroll jump again.

Current vs. Expected behavior

Current behavior:
When calling

router.push(`?${params.toString()}`, { scroll: false })

the page still scrolls to the top, but only in the production build and only when a loading.tsx file exists.

Expected behavior:
The page should not scroll to the top when { scroll: false } is passed, regardless of environment or presence of loading.tsx.

Provide environment information

Operating System:  Platform: darwin  Arch: arm64  Version: Darwin Kernel Version 23.6.0Binaries:  Node: 20.17.0  npm: 10.8.2  Yarn: 1.22.22  pnpm: 9.10.0Relevant Packages:"next":"^15.5.2","react":"19.1.0","react-dom":"19.1.0"Next.js Config:  output: N/A

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

Loading UI and Streaming

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

next build (local)

Additional context

Additional context

  • The issue seems to be tightly connected with the loading.tsx file. Without it, everything works fine.
  • Might be related to how Suspense boundaries or loading.tsx trigger re-render and reset scroll state.
  • Happens both locally and in production build environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Loading UI and StreamingRelated to loading UI (loading.tsx) and streaming.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp