Просмотр исходного кода

set useStaticSWR second arg undefined

kaori 3 лет назад
Родитель
Сommit
928bdeb6ac
2 измененных файлов с 4 добавлено и 6 удалено
  1. 2 3
      packages/app/src/stores/editor.tsx
  2. 2 3
      packages/app/src/stores/tag.tsx

+ 2 - 3
packages/app/src/stores/editor.tsx

@@ -94,8 +94,7 @@ export const useIsSlackEnabled = (): SWRResponse<boolean, Error> => {
   );
 };
 
-export const useStaticPageTags = (pageId: string | null | undefined): SWRResponse<ITagNames, Error> => {
+export const useStaticPageTags = (): SWRResponse<ITagNames, Error> => {
   const { data: pageTags } = useSWRxPageTags();
-  console.log('pageTags_hoge', pageTags);
-  return useStaticSWR<ITagNames, Error>('pageTags', pageTags || [], { fallbackData: pageTags });
+  return useStaticSWR<ITagNames, Error>('pageTags', undefined, { fallbackData: pageTags });
 };

+ 2 - 3
packages/app/src/stores/tag.tsx

@@ -27,12 +27,9 @@ export const useSWRxPageTags = (): SWRResponse<IListTagNamesByPage | undefined,
       return;
     }
 
-
     let tags: string[] = [];
     // when the page exists or is a shared page
     if (tagsInfoData != null && pageId != null && shareLinkId == null) {
-      // const res = await apiGet<IResGetPageTags>(endpoint, { pageId });
-      // tags = res?.tags;
       tags = tagsInfoData.tags;
     }
     // when the page does not exist
@@ -42,6 +39,8 @@ export const useSWRxPageTags = (): SWRResponse<IListTagNamesByPage | undefined,
       });
     }
 
+    console.log('tags_useSWRxPageTags', tags);
+
     return tags;
   };