diff --git a/next-14/src/app/actions.ts b/next-14/src/app/actions.ts index 80ca400..a147ac7 100644 --- a/next-14/src/app/actions.ts +++ b/next-14/src/app/actions.ts @@ -4,6 +4,7 @@ import type {SyncTag} from '@sanity/client' import {revalidateTag} from 'next/cache' export async function expireTags(tags: SyncTag[]) { + revalidateTag('sanity:tags') for (const tag of tags) { revalidateTag(tag) } diff --git a/next-14/src/sanity/fetch.ts b/next-14/src/sanity/fetch.ts index c614337..3f483df 100644 --- a/next-14/src/sanity/fetch.ts +++ b/next-14/src/sanity/fetch.ts @@ -13,7 +13,7 @@ export async function sanityFetch({ filterResponse: false, cacheMode: 'noStale', tag: 'fetch-sync-tags', // The request tag makes the fetch unique, avoids deduping with the cached query that has tags - next: {revalidate: 1}, // Ensure we don't opt out of ISR caching + next: {revalidate: false, tags: ['sanity:tags']}, // Ensure we don't opt out of ISR caching }) const data = await client.fetch(query, params, { cacheMode: 'noStale', diff --git a/next-15/src/app/actions.ts b/next-15/src/app/actions.ts index 80ca400..a147ac7 100644 --- a/next-15/src/app/actions.ts +++ b/next-15/src/app/actions.ts @@ -4,6 +4,7 @@ import type {SyncTag} from '@sanity/client' import {revalidateTag} from 'next/cache' export async function expireTags(tags: SyncTag[]) { + revalidateTag('sanity:tags') for (const tag of tags) { revalidateTag(tag) } diff --git a/next-15/src/sanity/fetch.ts b/next-15/src/sanity/fetch.ts index 6055508..6dac8f6 100644 --- a/next-15/src/sanity/fetch.ts +++ b/next-15/src/sanity/fetch.ts @@ -13,6 +13,7 @@ export async function sanityFetch({ filterResponse: false, cacheMode: 'noStale', tag: 'fetch-sync-tags', // The request tag makes the fetch unique, avoids deduping with the cached query that has tags + next: {revalidate: false, tags: ['sanity:tags']}, }) const data = await client.fetch(query, params, { cacheMode: 'noStale',