Replies: 2 comments
-
We us a revalidate hook that we put on the collections. On payload side:
And you put it in a collection like this:
On the nextjs side you create a API route like this:
And wherever you do the fetch call in nextjs frontend to your payload cms backend you have to put the tag as well:
On payload side you need REVALIDATE_CACHE_URL to be the url to the API route on nextjs side. This is our solution for when the payload cms and the frontend runs on different sites. |
Beta Was this translation helpful? Give feedback.
-
We are going to bring this in to first-party support, but @sannajammeh made a pretty shiny plugin for this: https://github.com/sannajammeh/payload-next-cache Check it out! |
Beta Was this translation helpful? Give feedback.
-
Will Payload CMS support tag-based revalidation in Next JS, if it is possible. I use tag-based ISR because it means less load on my server and provides a better experience for my editors. However, I cannot find a way to support this with Payload v3.
If anyone has suggestions besides time-based revalidation, I would always be happy to hear it. I think Sanity supports it but I have a feeling that Sanity uses a rest api and therefore some form of HTTP request.
What does everyone else think?
Beta Was this translation helpful? Give feedback.
All reactions