Clarifying revalidatePath behavior when called from Server Actions #87817
Replies: 1 comment
-
|
When you call a Server Action directly from an event handler like The intended semantics of
This creates the behavior you are seeing: when a Server Action successfully returns, the client router automatically does a soft refresh of the current page to sync with the server, because it assumes a mutation happened. This happens regardless of whether you passed a correct or incorrect path to If you provide a junk path like How to fix/clarify your implementation: If you are using Supabase directly in Server Components without TL;DR: The client refreshes the current page's UI automatically after any Server Action, which hides the fact that your |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I’m looking for clarification on the intended semantics of revalidatePath when it’s called from a Server Action, particularly when the action is invoked manually from the client.
Context
Observed behavior
Calling the Server Action with wrong revalidatePath url:
If revalidatePath is removed entirely:
I don't understand how adding an incorrect URL still revalidates the path correctly.
This is what I was expecting:
Beta Was this translation helpful? Give feedback.
All reactions