Repository navigation
useTransition stuck in loading state when using router.refresh() after calling a server action#86055Description
Link to the code that reproduces this issue
To Reproduce
- build the application as the issue only occurs on the built version:
pnpm run build - serve the application:
pnpm run start - go to http://localhost:3000/ in a browser
- click on the "trigger action" button
- see the button being stuck in
loading...state and the render date not being updated
If the button is not stuck, click on it a few times. If still not, re-start the application and try again. If not, add more <BigBlock /> in the page as it seems like the more blocks we add, the more likely the issue is to occur
Current vs. Expected behavior
The page is not re-rendered and the button is stuck on the loading state while the page should be re-rendered and the button not in loading state.
The issue is not always present though, even though it's there most of the case. It can occur on the first click but can work a few times and then not work. It seems like the more content I add to the page, the more likely the issue is to occur.
Here's a video of the issue:
Screencast.from.2025-11-12.21-18-42.webm
Here are a few things that I found made the issue disappear:
- remove the
loading.tsxfile - downgrade
nextto the version 15.4.7 (works even when specifying --turbopack to the build command) - keep only one
<BigBlock />in the page - stop awaiting
fakeDataRetrieval()
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #29~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jun 26 14:16:59 UTC 2
Available memory (MB): 63932
Available CPU cores: 22
Binaries:
Node: 22.20.0
npm: 10.9.3
Yarn: 1.22.22
pnpm: 9.15.5
Relevant Packages:
next: 16.0.1 // There is a newer version (16.0.2) available, upgrade recommended!
eslint-config-next: N/A
react: 19.2.0
react-dom: 19.2.0
typescript: 5.9.3
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next start (local)
Additional context
I tested the code with different versions of next and managed to find that the issue came with this commit
Activity
denk0403 commentedon Nov 13, 2025
Seems like this might be closely related to #84299 as well.
vinassefranche commentedon Nov 13, 2025
I found out that removing the
loading.tsxfile while adding aSuspensearound the page content also has the issue. Here's a branch on the reproduction repository that shows it.eps1lon commentedon Nov 18, 2025
@vinassefranche I cannot reproduce the described issue in Chrome on the repository you provided.
The issue says 16.0.1 but the repository uses 16.0.2. Is the repository reflecting the original issue? Can you include a video recording of the bad behavior?
vinassefranche commentedon Nov 19, 2025
@eps1lon The issue exists in both 16.0.1 and 16.0.2 (and in 16.0.3, 16.0.4 and 16.1.0 too by the way)
I had the issue on Brave but just tested on Chrome and I still have the issue.
Here's a recording of my last test with the full setup:
https://github.com/user-attachments/assets/c4e0c662-87ec-4766-b04b-db68115bba9a
Is there anything else I can do to help troubleshoot this?
Thanks for having a look anyway!
I also made a colleague that works on a Mac test the issue with the repo and he had it too, FYI.
vinassefranche commentedon Dec 4, 2025
@eps1lon any chance of moving forward on this? With the recent security issue, we upgraded to 15.4.8 which does not have the issue but we have some other issues with it in the dev mode. Being able to upgrade to v16 would be really nice.
Anything I can do to help move forward?
vinassefranche commentedon Jan 28, 2026
Relevant discussion comment about this here
fix: remove loading.tsx files to fix Next.js 16 router stuck bug (#86…
fix: Replace useTransition with manual state to prevent stuck pending
fix: Replace useTransition with manual state to prevent stuck pending
vinassefranche commentedon Apr 2, 2026
I've just tested on the
v16.2.1-canary.17and the issue seems to be fixed, at least on my reproduction repositoryvinassefranche commentedon Apr 2, 2026
The real version that fixed the issue is v16.2.1-canary.11
I suspect the fix commit is: Upgrade React from 8b2e903a-20260320 to 3cb2c420-20260324: #91905
Can't wait for the next real version to be able to upgrade to v16!
christopherjohnson3028-stack commentedon Apr 2, 2026
vinassefranche commentedon Apr 9, 2026
@eps1lon because of this issue, we can't upgrade to
15.5.15and16.2.3so we can't benefit from the security fix of these releases.Is it possible to have one of the 2 following options?
Thanks in advance for your answer and support.
christopherjohnson3028-stack commentedon Apr 9, 2026
starlightroad commentedon May 25, 2026
Thank you for this. This was taking me so much time to figure out.
I was trying to mutate data via a server action on a dynamic route. The server action re-validates some paths and returns the object
{ success: true, serverErrors: null }. When the server action was called, the button to update the data was stuck in a disabled state because the server action returnedundefinedinstead of the object I defined. Once I removed the fileloading.tsxfrom the same directory where the dynamic route page was located, everything worked as usual.The Next.js version I am using is
16.2.6.vinassefranche commentedon May 27, 2026
@starlightroad welcome to the ones desperately waiting for v16.3.0 to be released 😅
john-melin commentedon May 29, 2026
Im experiencing similar things though without loading.tsx. Moving from the startTransition based approach with server action or next safe action to fetching with tanstack query fixes it.
gaearon commentedon Jul 3, 2026
This must have been fixed by react/react#36134, which will go out in 16.3.0.
I'm closing because this is also fixed in latest
canary.test(e2e): serialized route warm-up; document why e2e stays on next dev
test(e2e): serialized route warm-up; document why e2e stays on next dev
Fix real root cause of the 120s production-like E2E upload hang
github-actions commentedon Sep 7, 2026
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.