فهرست منبع

Fixed lint errors

Taichi Masuyama 4 سال پیش
والد
کامیت
8cf66be2a1
2فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 2 2
      packages/app/src/components/Sidebar/PageTree.tsx
  2. 2 2
      packages/app/src/stores/ui.tsx

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

@@ -18,7 +18,7 @@ const PageTree: FC = memo(() => {
   const { data: currentPath } = useCurrentPagePath();
   const { data: targetId } = useCurrentPageId();
   const { data: targetAndAncestorsData } = useTargetAndAncestors();
-  const { data: notFoundTargetPathOrId } = useNotFoundTargetPathOrId();
+  const { data: notFoundTargetPathOrIdData } = useNotFoundTargetPathOrId();
 
   const { data: migrationStatus } = useSWRxV5MigrationStatus();
 
@@ -26,7 +26,7 @@ const PageTree: FC = memo(() => {
   const [isDeleteModalOpen, setDeleteModalOpen] = useState(false);
   const [pagesToDelete, setPagesToDelete] = useState<IPageForPageDeleteModal[]>([]);
 
-  const targetPathOrId = targetId || notFoundTargetPathOrId;
+  const targetPathOrId = targetId || notFoundTargetPathOrIdData?.notFoundTargetPathOrId;
 
   if (migrationStatus == null) {
     return (

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

@@ -280,14 +280,14 @@ export const useCreateModalOpened = (): SWRResponse<boolean, Error> => {
   );
 };
 
-export const useCreateModalPath = (): SWRResponse<string, Error> => {
+export const useCreateModalPath = (): SWRResponse<string | null | undefined, Error> => {
   const { data: currentPagePath } = useCurrentPagePath();
   const { data: status } = useCreateModalStatus();
 
   return useSWR(
     [currentPagePath, status],
     (currentPagePath, status) => {
-      return status.path || currentPagePath;
+      return status?.path || currentPagePath;
     },
   );
 };