From 5eb1e1ba55e1520544373324b04725aac82a7fb2 Mon Sep 17 00:00:00 2001 From: Cody Olsen Date: Thu, 21 Nov 2024 16:47:56 +0100 Subject: [PATCH] fixes --- next-enterprise/src/sanity/client.ts | 2 +- next-enterprise/src/sanity/fetch.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/next-enterprise/src/sanity/client.ts b/next-enterprise/src/sanity/client.ts index 7858942..7d5dd00 100644 --- a/next-enterprise/src/sanity/client.ts +++ b/next-enterprise/src/sanity/client.ts @@ -3,6 +3,6 @@ import {createClient} from '@sanity/client' export const client = createClient({ projectId: 'hiomol4a', dataset: 'lcapi', - apiVersion: '2024-09-19', + apiVersion: '2024-09-20', useCdn: false, }) diff --git a/next-enterprise/src/sanity/fetch.ts b/next-enterprise/src/sanity/fetch.ts index 7977e99..abacd69 100644 --- a/next-enterprise/src/sanity/fetch.ts +++ b/next-enterprise/src/sanity/fetch.ts @@ -8,11 +8,11 @@ export async function sanityFetch({ query: QueryString params?: QueryParams }) { + // Uncached query that fetches cache tags (on Next 15 uncached doesn't mean on every browser request, but on every ISR build) const {syncTags: tags} = await client.fetch(query, params, { filterResponse: false, - returnQuery: false, + tag: 'fetch-sync-tags', // The request tag makes the fetch unique, avoids deduping with the cached query that has tags }) - const {result, syncTags} = await client.fetch(query, params, {next: {tags}}) - - return {data: result, tags: syncTags, fetchedAt: new Date().toJSON()} + const data = await client.fetch(query, params, {next: {tags}}) + return {data, tags, fetchedAt: new Date().toJSON()} }