next.jsserver-action

Use both revalidatePath and Return Value in Server Action?


Can someone help me Description: I use useFormState with server action, but when i use both revalidatePath and return value, the revalidatePath work but doesn't return any value state for useFormState, when i remove revalidatePath, the returned value is received as normal, but i want to use both, any one can solve this?

I tried to remove one of two and it works perfect but not work using both, i want to use both of them enter image description here


Solution

  • Having a loading template inside the root of the /app directory was causing the issue for me. Removing the loading templates resolved the issue.