Yuki Takei 4 mesi fa
parent
commit
64086d0270
1 ha cambiato i file con 10 aggiunte e 10 eliminazioni
  1. 10 10
      apps/app/src/stores/page-listing.tsx

+ 10 - 10
apps/app/src/stores/page-listing.tsx

@@ -190,12 +190,20 @@ export const useSWRxPageInfoForList = (
   };
 };
 
+const MUTATION_ID_FOR_PAGETREE = 'pageTree';
+const keyMatcherForPageTree = (key: Arguments): boolean => {
+  return Array.isArray(key) && key[0] === MUTATION_ID_FOR_PAGETREE;
+};
+export const mutatePageTree = async (): Promise<undefined[]> => {
+  return mutate(keyMatcherForPageTree);
+};
+
 export const useSWRxRootPage = (
   config?: SWRConfiguration,
 ): SWRResponse<RootPageResult, Error> => {
   return useSWR(
-    '/page-listing/root',
-    (endpoint) =>
+    [MUTATION_ID_FOR_PAGETREE, '/page-listing/root'],
+    ([, endpoint]) =>
       apiv3Get(endpoint).then((response) => {
         return {
           rootPage: response.data.rootPage,
@@ -210,14 +218,6 @@ export const useSWRxRootPage = (
   );
 };
 
-const MUTATION_ID_FOR_PAGETREE = 'pageTree';
-const keyMatcherForPageTree = (key: Arguments): boolean => {
-  return Array.isArray(key) && key[0] === MUTATION_ID_FOR_PAGETREE;
-};
-export const mutatePageTree = async (): Promise<undefined[]> => {
-  return mutate(keyMatcherForPageTree);
-};
-
 export const useSWRxPageChildren = (
   id?: string | null,
 ): SWRResponse<ChildrenResult, Error> => {