From a906de359f00eacbbeffd3709c21dd6990ed3686 Mon Sep 17 00:00:00 2001 From: Julian Benegas Date: Tue, 9 Apr 2024 10:13:23 -0300 Subject: [PATCH 1/2] cache no store in draft mode --- packages/basehub/src/bin/main.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/basehub/src/bin/main.ts b/packages/basehub/src/bin/main.ts index 6afefafe..aa3e4e83 100644 --- a/packages/basehub/src/bin/main.ts +++ b/packages/basehub/src/bin/main.ts @@ -110,6 +110,7 @@ export const main = async (args: Args, opts?: { forceDraft?: boolean }) => { ); // 3. append our basehub function to the end of the file. + const basehubExport = getBaseHubExport(draft); if (!schemaFileContents.includes(basehubExport)) { schemaFileContents = schemaFileContents.concat(`\n${basehubExport}`); } @@ -227,7 +228,7 @@ export const main = async (args: Args, opts?: { forceDraft?: boolean }) => { } }; -const basehubExport = ` +const getBaseHubExport = (noStore: boolean) => ` export * from "@basehub/mutation-api-helpers"; import { createFetcher } from "./runtime"; @@ -254,7 +255,9 @@ export const basehub = (options?: Options) => { const { url, headers } = getStuffFromEnv(options); return { - ...createClient(options), + ...createClient(${ + noStore ? "{ ...options, cache: 'no-store' }" : "options" + }), raw: createFetcher({ ...options, url, headers }) as ( gql: GraphqlOperation ) => Promise, From b0d2975f4092d8cb2b63043418c675f6d8d44425 Mon Sep 17 00:00:00 2001 From: Julian Benegas Date: Tue, 9 Apr 2024 12:52:22 -0300 Subject: [PATCH 2/2] Create strong-radios-lie.md --- .changeset/strong-radios-lie.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/strong-radios-lie.md diff --git a/.changeset/strong-radios-lie.md b/.changeset/strong-radios-lie.md new file mode 100644 index 00000000..0a813951 --- /dev/null +++ b/.changeset/strong-radios-lie.md @@ -0,0 +1,5 @@ +--- +"basehub": patch +--- + +cache no store in draft mode