From 3419081de4c0aff3b431ce0fe8dc9be382236009 Mon Sep 17 00:00:00 2001 From: Duncan Fairley Date: Fri, 27 Sep 2024 13:57:16 -0700 Subject: [PATCH] Add cache purge key --- packages/hydrogen/src/storefront.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/hydrogen/src/storefront.ts b/packages/hydrogen/src/storefront.ts index 832fd33ba0..f88768c9f4 100644 --- a/packages/hydrogen/src/storefront.ts +++ b/packages/hydrogen/src/storefront.ts @@ -177,7 +177,7 @@ type HydrogenClientProps = { }; export type CreateStorefrontClientOptions = - HydrogenClientProps & StorefrontClientProps; + HydrogenClientProps & StorefrontClientProps & { cachePurgeKey?: string }; type StorefrontQueryOptions = StorefrontCommonExtraParams & { query: string; @@ -208,6 +208,7 @@ export function createStorefrontClient( i18n, storefrontId, logErrors = true, + cachePurgeKey, ...clientOptions } = options; const H2_PREFIX_WARN = '[h2:warn:createStorefrontClient] '; @@ -310,6 +311,7 @@ export function createStorefrontClient( requestInit.method, cacheKeyHeader, requestInit.body, + cachePurgeKey ]; const [body, response] = await fetchWithServerCache(url, requestInit, {