Skip to content

useTransition stuck in loading state when using router.refresh() after calling a server action #86055

Closed

Description

@vinassefranche

Link to the code that reproduces this issue

https://github.com/vinassefranche/use-transition-hanging

To Reproduce

  1. build the application as the issue only occurs on the built version: pnpm run build
  2. serve the application: pnpm run start
  3. go to http://localhost:3000/ in a browser
  4. click on the "trigger action" button
  5. 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.tsx file
  • downgrade next to 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/A

Which 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

  1. denk0403 commented on Nov 13, 2025

    @denk0403

    Seems like this might be closely related to #84299 as well.

  2. vinassefranche commented on Nov 13, 2025

    @vinassefranche
    Author

    I found out that removing the loading.tsx file while adding a Suspense around the page content also has the issue. Here's a branch on the reproduction repository that shows it.

  3. eps1lon commented on Nov 18, 2025

    @eps1lon
    Contributor

    @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?

  4. vinassefranche commented on Nov 19, 2025

    @vinassefranche
    Author

    @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.

  5. vinassefranche commented on Dec 4, 2025

    @vinassefranche
    Author

    @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?

  6. added
    linear: next
    on Dec 29, 2025
  7. vinassefranche commented on Jan 28, 2026

    @vinassefranche
    Author

    Relevant discussion comment about this here

  8. vinassefranche commented on Apr 2, 2026

    @vinassefranche
    Author

    I've just tested on the v16.2.1-canary.17 and the issue seems to be fixed, at least on my reproduction repository

  9. vinassefranche commented on Apr 2, 2026

    @vinassefranche
    Author

    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!

  10. christopherjohnson3028-stack commented on Apr 2, 2026

    @christopherjohnson3028-stack
  11. vinassefranche commented on Apr 9, 2026

    @vinassefranche
    Author

    @eps1lon because of this issue, we can't upgrade to 15.5.15 and 16.2.3 so we can't benefit from the security fix of these releases.
    Is it possible to have one of the 2 following options?

    • have a 15.4.12 version with the security fix
    • have the 16.3.0 release done fast as it fixes the issue

    Thanks in advance for your answer and support.

  12. christopherjohnson3028-stack commented on Apr 9, 2026

    @christopherjohnson3028-stack
  13. starlightroad commented on May 25, 2026

    @starlightroad

    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 returned undefined instead of the object I defined. Once I removed the file loading.tsx from 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.

  14. vinassefranche commented on May 27, 2026

    @vinassefranche
    Author

    @starlightroad welcome to the ones desperately waiting for v16.3.0 to be released 😅

  15. john-melin commented on May 29, 2026

    @john-melin

    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.

  16. gaearon commented on Jul 3, 2026

    @gaearon
    Contributor

    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.

  17. github-actions commented on Sep 7, 2026

    @github-actions
    Contributor

    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.

  18. locked as resolved and limited conversation to collaborators on Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    linear: nextlocked

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions