这是indexloc提供的服务,不要输入任何密码
Skip to content

Soft-navigation sometimes gets stuck and doesn't render the new page, despite receiving it from the server #86151

@mogzol

Description

@mogzol

Link to the code that reproduces this issue

https://github.com/mogzol/next-stuck-navigation-repro

Relevant components:

  • RefreshButton.tsx - Calls router.refresh() to trigger the soft refresh that sometimes gets stuck
  • page.tsx - Renders the refresh button as well as several slow client components that increase page size and render time

To Reproduce

  1. Start the application in production mode (npm run build && npm run start)
  2. Open the page in your browser and press the "Refresh" button on the page to trigger a soft refresh (calls router.refresh())
  3. Observe that sometimes the new page never loads, and the loading indicator stays visible indefinitely.
    • The request for the new page still completes successfully in the network monitor
    • Changing network request throttling can make this issue more or less likely ("Fast 4G" almost always triggers it, "Slow 4G" never does)
    • Changing the GARBAGE_ITEMS environment variable before starting the app also makes the issue more or less likely
      • GARBAGE_ITEMS=10 npm run start - Almost never has the issue
      • GARBAGE_ITEMS=100 npm run start - Almost always has the issue

Here's a screen recording showing the issue. The first couple refreshes work fine, but then it gets stuck on the third one. Then after performing a full page reload, it gets stuck again on the first refresh. Then after changing the network request throttling to "Slow 4G", the issue goes away.

Screen.Recording.2025-11-14.at.7.05.59.PM.mov

Current vs. Expected behavior

I would expect the soft refresh to always work, and never get stuck. Currently, it randomly gets stuck. It seems that this is more likely if your page has client components that take a while to render.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 32673
  Available CPU cores: 24
Binaries:
  Node: 24.11.1
  npm: 11.6.2
  Yarn: 1.22.22
  pnpm: 10.7.1
Relevant Packages:
  next: 16.0.3 // Latest available version is detected (16.0.3).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

I also tested this on macOS and confirmed it occurs there. I have tested both Chrome and Firefox and the issue occurs in both.

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

Linking and Navigating

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

next start (local), Other (Deployed)

Additional context

I have been able to reproduce this issue on both Next.js 15 and Next.js 16, I'm not sure when it was introduced. It only seems to happen on pages that have a loading.tsx file. I haven't been able to reproduce it for pages that don't have a loading UI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Linking and NavigatingRelated to Next.js linking (e.g., <Link>) and navigation.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions