revalidatePath on route handler
Unanswered
Eric Burel posted this in #help-forum
^_ all on the title: is that doable to call "revalidatePath("/api/something")", on Route handler URL rather than a page?
I tried it on 13.4, it doesn't seem to work. The documentation doesn't mention it, and I found no issues. Yet, Route Handlers are being statically built if they don't have explicit dynamic requirement. So, it would probably make sense to be able to invalidate them on demand. But it doesn't seem possible. I am using "export const dynamic = "force-dynamic"" in the meantime
I tried it on 13.4, it doesn't seem to work. The documentation doesn't mention it, and I found no issues. Yet, Route Handlers are being statically built if they don't have explicit dynamic requirement. So, it would probably make sense to be able to invalidate them on demand. But it doesn't seem possible. I am using "export const dynamic = "force-dynamic"" in the meantime
4 Replies
Small bump
Good question… I never thought of this use case before. Does it work if you tag the query using fetch/unstable_cache, and you use revalidateTag?
What you said should work but maybe because it’s not part of the react router it was overlooked. I think if it really can’t work then you might need to open a new issue (or make a new PR
)
What you said should work but maybe because it’s not part of the react router it was overlooked. I think if it really can’t work then you might need to open a new issue (or make a new PR
)@joulev Good question… I never thought of this use case before. Does it work if you tag the query using fetch/unstable_cache, and you use revalidateTag?
What you said *should* work but maybe because it’s not part of the react router it was overlooked. I think if it really can’t work then you might need to open a new issue (or make a new PR <:sunglasses_1:767749456648339497>)
couldn't have revalidateTag to work atm, will try again with Next 14 I think and open a few tickets ':)
there are alternatives so not too big a deal but I am trying to list all possible patterns