From b8f6bc24d2fb159d194979238763d3710afd95c6 Mon Sep 17 00:00:00 2001 From: Chloe Date: Tue, 9 Jul 2024 12:04:28 +0700 Subject: [PATCH] cache meatobject requests Signed-off-by: Chloe --- lib/shopify/index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/shopify/index.ts b/lib/shopify/index.ts index 19eac8f3a..000146dd7 100644 --- a/lib/shopify/index.ts +++ b/lib/shopify/index.ts @@ -205,12 +205,14 @@ async function shopifyAdminFetch({ headers, query, variables, - tags + tags, + cache = 'no-store' }: { headers?: HeadersInit; query: string; variables?: ExtractVariables; tags?: string[]; + cache?: RequestCache; }): Promise<{ status: number; body: T } | never> { try { const result = await fetch(adminEndpoint, { @@ -225,7 +227,7 @@ async function shopifyAdminFetch({ ...(variables && { variables }) }), ...(tags && { next: { tags } }), - cache: 'no-store' + cache }); const body = await result.json(); @@ -939,7 +941,8 @@ export async function getMetaobjectReferences( data: { metaobject: ShopifyMetaobject }; }>({ query: getMetaobjectReferencesQuery, - variables: { id, after } + variables: { id, after }, + cache: 'force-cache' }); const metaobject = res.body.data.metaobject;