@@ -14,12 +14,6 @@ import { sanityFetch } from './live'
1414export 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-
2317const 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
4949export const routeSanityFetch : DefinedFetchType = async options => {
0 commit comments