Parcourir la source

fix revalidation problem

Yuki Takei il y a 4 ans
Parent
commit
c55419bd34
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  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> => {
 export const useSWRxPageComment = (pageId: Nullable<string>): SWRResponse<ICommentHasIdList, Error> => {
   const shouldFetch: boolean = pageId != null;
   const shouldFetch: boolean = pageId != null;
   return useSWR(
   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),
   );
   );
 };
 };