nextjs - 💡(How to fix) Fix App freezes after back navigation when visiting route via manual URL [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#93136Fetched 2026-04-23 07:21:49
View on GitHub
Comments
2
Participants
2
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
commented ×2closed ×1issue_type_added ×1

Code Example

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 32599
  Available CPU cores: 28
Binaries:
  Node: 22.15.1
  npm: 11.6.2
  Yarn: N/A
  pnpm: 10.21.0
Relevant Packages:
  next: 16.2.4 // Latest available version is detected (16.2.4).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/JulienB18/nextjs16-back-issue

To Reproduce

  1. Install the app and start it in development mode (next dev)
  2. Click on the button ("Click button") → an alert is displayed
  3. Go to the login page by manually typing the URL localhost:3000/login
  4. Go back using the browser back button and click the button again ("Click button") → the alert does not appear anymore
  5. Refresh the page → click on the button ("Click button") → an alert is displayed
  6. Click on the button ("Go to login page")
  7. Go back using the browser back button and click the button again ("Click button") → the alert is displayed again

Current vs. Expected behavior

Here is a video where I reproduce the bug

https://github.com/user-attachments/assets/87c94add-0a04-4737-a78c-44a3fd4e3395

The expected behavior is that when I manually navigate to the login page and then go back using the browser back button, the JavaScript should not freeze and the buttons should continue to work normally. If you put an useEffect(() => {console.log("test")}, []); it will not work too after the back.

If you navigate to the login page using a router push and then go back using the browser back button, everything works correctly.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 32599
  Available CPU cores: 28
Binaries:
  Node: 22.15.1
  npm: 11.6.2
  Yarn: N/A
  pnpm: 10.21.0
Relevant Packages:
  next: 16.2.4 // Latest available version is detected (16.2.4).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A

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

Not sure

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

next dev (local)

Additional context

I got the bug on Chrome and Firefox. I tested my reproduction on NextJS v15.5.15 and I dont have this bug.

extent analysis

TL;DR

The issue can be mitigated by using the useEffect hook with a dependency array that includes the necessary variables to re-run the effect when the component is re-rendered after navigating back using the browser back button.

Guidance

  • The problem seems to be related to the way Next.js handles client-side navigation and the browser's back button, specifically in version 16.2.4.
  • To verify the issue, try using the useEffect hook with a dependency array that includes the necessary variables, and check if the effect is re-run when navigating back using the browser back button.
  • Consider using the router.push method to navigate to the login page instead of manual navigation, as this seems to work correctly.
  • Try downgrading to Next.js version 15.5.15, as the issue is not present in this version.

Example

No code snippet is provided as the issue is not clearly related to a specific code snippet.

Notes

The issue seems to be specific to Next.js version 16.2.4 and may be related to changes in the way client-side navigation is handled. Further investigation is needed to determine the root cause of the issue.

Recommendation

Apply workaround: Use the router.push method to navigate to the login page instead of manual navigation, as this seems to work correctly. This is a temporary solution until the root cause of the issue is determined and a fix is available.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - 💡(How to fix) Fix App freezes after back navigation when visiting route via manual URL [2 comments, 2 participants]