Taichi Masuyama 4 ani în urmă
părinte
comite
d20e85c99f

+ 2 - 2
packages/app/src/components/Sidebar/PageTree/ItemsTree.tsx

@@ -42,7 +42,7 @@ const generateInitialNodeAfterResponse = (ancestorsChildren: Record<string, Part
     currentNode.children = ItemNode.generateNodesFromPages(childPages);
     currentNode.children = ItemNode.generateNodesFromPages(childPages);
 
 
     const nextNode = currentNode.children.filter((node) => {
     const nextNode = currentNode.children.filter((node) => {
-      return paths.includes(node.page.path);
+      return paths.includes(node.page.path as string);
     })[0];
     })[0];
     currentNode = nextNode;
     currentNode = nextNode;
   });
   });
@@ -60,7 +60,7 @@ const ItemsTree: FC = () => {
 
 
   const { data: targetAndAncestors, error } = useTargetAndAncestors();
   const { data: targetAndAncestors, error } = useTargetAndAncestors();
 
 
-  const { data: ancestorsChildrenData, error: error2 } = useSWRxPageAncestorsChildren(targetAndAncestors != null ? path : null);
+  const { data: ancestorsChildrenData, error: error2 } = useSWRxPageAncestorsChildren(path);
 
 
   if (error != null || error2 != null) {
   if (error != null || error2 != null) {
     return null;
     return null;

+ 1 - 1
packages/app/src/stores/context.tsx

@@ -4,5 +4,5 @@ import { useStaticSWR } from './use-static-swr';
 import { TargetAndAncestors } from '../interfaces/page-listing-results';
 import { TargetAndAncestors } from '../interfaces/page-listing-results';
 
 
 export const useTargetAndAncestors = (initialData?: TargetAndAncestors): SWRResponse<TargetAndAncestors, Error> => {
 export const useTargetAndAncestors = (initialData?: TargetAndAncestors): SWRResponse<TargetAndAncestors, Error> => {
-  return useStaticSWR<TargetAndAncestors, Error>('swr-targetAndAncestors', null, initialData);
+  return useStaticSWR<TargetAndAncestors, Error>('swr-targetAndAncestors', initialData);
 };
 };

+ 1 - 1
packages/app/src/stores/use-static-swr.tsx

@@ -6,8 +6,8 @@ import { Fetcher } from 'swr/dist/types';
 
 
 export const useStaticSWR = <Data, Error>(
 export const useStaticSWR = <Data, Error>(
   key: Key,
   key: Key,
-  updateData?: Data | Fetcher<Data>,
   initialData?: Data | Fetcher<Data>,
   initialData?: Data | Fetcher<Data>,
+  updateData?: Data | Fetcher<Data>,
 ): SWRResponse<Data, Error> => {
 ): SWRResponse<Data, Error> => {
   const { cache } = useSWRConfig();
   const { cache } = useSWRConfig();
 
 

+ 1 - 1
packages/app/src/utils/swr-utils.ts

@@ -2,7 +2,7 @@ import { SWRConfiguration } from 'swr';
 
 
 
 
 export const swrGlobalConfiguration: SWRConfiguration = {
 export const swrGlobalConfiguration: SWRConfiguration = {
-  fetcher: null,
+  fetcher: undefined,
   revalidateOnFocus: false,
   revalidateOnFocus: false,
   errorRetryCount: 1,
   errorRetryCount: 1,
 };
 };