Why doesn't the page revalidate when I call revalidatePath
Unanswered
Matvey posted this in #help-forum
MatveyOP
I don't understand how nextjs cache revalidation works. I made a small demo here - https://github.com/ronanru/revalidation-repro. When I click the "revalidate" button on https://revalidation-repro.vercel.app/revalidate it calls a server action that calls
revalidatePath("/test", "page"), but the content of https://revalidation-repro.vercel.app/test doesn't change at all. Why? How do I revalidate the cache for this page?3 Replies
Philippine Crocodile
Try to make your action an async function and see if that helps.
@Philippine Crocodile Try to make your action an async function and see if that helps.
MatveyOP
Thank you for the suggestion. Unfortunately, it didn't work, the page doesn't revalidate.
Philippine Crocodile
And what happens if you wrap that client button with a form and change the button type to submit and call the server action with the action prop on the form?