Next.js Discord

Discord Forum

unstable_cache tags based on the request result

Unanswered
Paper wasp posted this in #help-forum
Open in Discord
Avatar
Paper waspOP
Hi !

I'm using contentful and Next.js, with the ISR feature. I would like to tag the cache with the different IDs from the contentful entries, so that I can invalidate them easily with the Contentful webhook.

I cannot find a proper way to tag the content with unstable_cache based on the request result. Basically what I want to achieve is what is done here https://nextjs.org/docs/app/api-reference/functions/cacheTag#creating-tags-from-external-data with 'use cache' but with unstable_cache since 'use cache' and cacheTags are not available on the stable release.

Any idea ?

so far the only way I found is to fetch before and leave the async function empty in the unstable_cache but this only helps to tag the page and looses the cache when fetching the RSC.

0 Replies