Skip to content

Commit a80045f

Browse files
committed
Merge branch 'padms/3890' into staging
2 parents 24609f4 + fb1a420 commit a80045f

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

web/sanity/lib/fetch.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ import { sanityFetch } from './live'
1414
export const IS_FETCH_OPTIMIZED =
1515
process.env.NEXT_PUBLIC_OPTIMIZED_SANITY_FETCH === 'true'
1616

17-
/** Tag applied to every optimized fetch, used by the revalidation webhook. */
18-
export const SANITY_CACHE_TAG = 'sanity'
19-
20-
export const documentCacheTag = (id: string) => `sanity:id:${id}`
21-
export const documentTypeCacheTag = (type: string) => `sanity:type:${type}`
22-
2317
const optimizedFetch: DefinedFetchType = async ({
2418
query,
2519
params = {},
@@ -28,8 +22,14 @@ const optimizedFetch: DefinedFetchType = async ({
2822
perspective = 'published',
2923
requestTag = 'optimized-fetch',
3024
}) => {
31-
const cacheTags = [SANITY_CACHE_TAG, ...tags]
32-
25+
console.log('Fetching with optimized fetch:', {
26+
query,
27+
params,
28+
tags,
29+
stega,
30+
perspective,
31+
requestTag,
32+
})
3333
const { result, resultSourceMap } = await client.fetch(query, await params, {
3434
filterResponse: false,
3535
perspective,
@@ -39,11 +39,11 @@ const optimizedFetch: DefinedFetchType = async ({
3939
next: {
4040
// only revalidated on demand through the Sanity webhook
4141
revalidate: false,
42-
tags: cacheTags,
42+
tags: tags,
4343
},
4444
})
4545

46-
return { data: result, sourceMap: resultSourceMap ?? null, tags: cacheTags }
46+
return { data: result, sourceMap: resultSourceMap ?? null, tags: tags }
4747
}
4848

4949
export const routeSanityFetch: DefinedFetchType = async options => {

0 commit comments

Comments
 (0)