Bläddra i källkod

fix revalidation problem

Yuki Takei 4 år sedan
förälder
incheckning
c55419bd34
1 ändrade filer med 2 tillägg och 2 borttagningar
  1. 2 2
      packages/app/src/stores/comment.tsx

+ 2 - 2
packages/app/src/stores/comment.tsx

@@ -13,7 +13,7 @@ type IResponseComment = {
 export const useSWRxPageComment = (pageId: Nullable<string>): SWRResponse<ICommentHasIdList, Error> => {
   const shouldFetch: boolean = pageId != null;
   return useSWR(
-    shouldFetch ? '/comments.get' : null,
-    endpoint => apiGet(endpoint, { page_id: pageId }).then((response:IResponseComment) => response.comments),
+    shouldFetch ? ['/comments.get', pageId] : null,
+    (endpoint, pageId) => apiGet(endpoint, { page_id: pageId }).then((response:IResponseComment) => response.comments),
   );
 };