useTransition()'s isPending state remains true indefinitely when revalidatePath() is invoked within a Server Action on Next.js v15 #82289
Replies: 1 comment 2 replies
-
Hi @yousefdawood7, Thanks for the detailed report. This issue with useTransition’s isPending staying true after calling revalidatePath() inside a Server Action wrapped with startTransition() is a known regression in Next.js v15. What happens is the Server Action finishes and triggers a re-render, but React’s pending state does not reset, so the UI stays stuck in loading. This problem did not exist in v14 and is likely related to changes in how cache revalidation and suspense boundaries are handled internally in v15. Possible workarounds: Call revalidatePath() outside of the startTransition block if possible. Try using router.refresh() after the Server Action completes, but not inside startTransition. Manage your own loading state alongside useTransition and reset it manually when revalidation finishes. If feasible, downgrade to Next.js v14 until the issue is fixed. Report this bug to the Next.js team if not done already. Thanks for sharing the video. It clearly shows the problem and will help in fixing it. Let me know if you want help preparing a minimal reproduction or filing a bug report. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When calling revalidatePath() from within a Server Action wrapped in startTransition(), React’s isPending flag never resets. The UI stays stuck in "pending" state even though:
The Server Action completes.
The Component Re-Render and i see the logs but doesn't reflect the UI (That what freaks me out)
But the loading indicator remains active forever untill i switch from route to the another
This happens ONLY in Next.js v15 — the same code works without issue in v14.
But if i do remove anything that revalidate the cache it works perfectly fine
here is my server action
and my here is my component
and i did try router.refresh() didn't works also
Current vs. Expected behavior:
The Current behavior:
useTransition with anything that revalidate the cache won't reset the pending state
Video of the behavior: https://streamable.com/dupftt
The Expected behavior:
after the revalidation the pending state get back to its initial state
473279676-59e54de9-593b-42e7-ac05-6015e9c8833c.mp4
Beta Was this translation helpful? Give feedback.
All reactions