Adding no-cache to our client fetch to fix Next.js POST caching

This commit is contained in:
Eric Allam
2023-11-06 17:38:05 +00:00
parent 13345d0025
commit 4a0f030ebf
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@trigger.dev/sdk": patch
---
Adding no-cache to our client fetch to fix Next.js POST caching
+2 -2
View File
@@ -612,7 +612,7 @@ async function zodfetchWithVersions<
? VersionedResponseBody<TVersionedResponseBodyMap, TUnversionedResponseBodySchema> | undefined
: VersionedResponseBody<TVersionedResponseBodyMap, TUnversionedResponseBodySchema>
> {
const response = await fetch(url, requestInit);
const response = await fetch(url, { ...requestInit, cache: "no-cache" });
if (
(!requestInit || requestInit.method === "GET") &&
@@ -686,7 +686,7 @@ async function zodfetch<TResponseSchema extends z.ZodTypeAny, TOptional extends
): Promise<
TOptional extends true ? z.infer<TResponseSchema> | undefined : z.infer<TResponseSchema>
> {
const response = await fetch(url, requestInit);
const response = await fetch(url, { ...requestInit, cache: "no-cache" });
if (
(!requestInit || requestInit.method === "GET") &&