Next.js Discord

Discord Forum

Confusion with Next.js docs (revalidation)

Unanswered
Ant posted this in #help-forum
Open in Discord
AntOP
I have issues with revalidatePath, used in route handler. Seems that more people have: https://www.reddit.com/r/nextjs/comments/1e8gbgs/revalidatepath_not_working_as_expected/

Can documentation have such a mismatches?

3 Replies

This is just a client router cache issue.. so basically as op mentioned it works with server actions but not route handlers. This is because a server action handles both the actual work and the revalidation in the same request. With a route handlers you need to manually add a router.refresh() to reload the page and actually get the fresh data. Nextjs 15 adds a way for you to completely disable this cache but idt that exists for 14.
Answered the same in the reddit post
@Ant