zgl il y a 1 semaine
Parent
commit
b3b7166c19
1 fichiers modifiés avec 6 ajouts et 1 suppressions
  1. 6 1
      src/lib/graphql-fetch.ts

+ 6 - 1
src/lib/graphql-fetch.ts

@@ -127,8 +127,13 @@ export async function graphqlRequest<
     queryOption = {
       query,
       variables,
-      context: options?.context,
       fetchPolicy: "no-cache", // 跳过 apollo client 的缓存,直接调fetch
+      context: {
+        ...options?.context,
+        fetchOptions: {
+          cache: 'no-store',   // 👈 告诉 Next.js 不要缓存这个 fetch
+        },
+      },
     };
   }