Yuki Takei 4 лет назад
Родитель
Сommit
decd4cb56f
2 измененных файлов с 17 добавлено и 11 удалено
  1. 11 8
      packages/app/src/components/IdenticalPathPage.tsx
  2. 6 3
      packages/app/src/stores/ui.tsx

+ 11 - 8
packages/app/src/components/IdenticalPathPage.tsx

@@ -1,6 +1,7 @@
 import React, {
   FC,
 } from 'react';
+import { useTranslation } from 'react-i18next';
 
 import { DevidedPagePath } from '@growi/core';
 
@@ -8,7 +9,6 @@ import { useCurrentPagePath } from '~/stores/context';
 
 import PageListItem from './Page/PageListItem';
 
-import { useTranslation } from 'react-i18next';
 
 
 type IdenticalPathAlertProps = {
@@ -19,13 +19,14 @@ const IdenticalPathAlert : FC<IdenticalPathAlertProps> = (props: IdenticalPathAl
   const { path } = props;
   const { t } = useTranslation();
 
-  const devidedPath = new DevidedPagePath(path);
-  const _path = path != null
-    ? (devidedPath.isFormerRoot ? '/' : devidedPath.former)
-    : '――';
-  const _pageName = path != null
-    ? devidedPath.latter
-    : '――';
+  let _path = '――';
+  let _pageName = '――';
+
+  if (path != null) {
+    const devidedPath = new DevidedPagePath(path);
+    _path = devidedPath.isFormerRoot ? '/' : devidedPath.former;
+    _pageName = devidedPath.latter;
+  }
 
   return (
     <div className="alert alert-warning py-3">
@@ -45,6 +46,8 @@ const IdenticalPathAlert : FC<IdenticalPathAlertProps> = (props: IdenticalPathAl
 type IdenticalPathPageProps= {
   // add props and types here
 }
+
+
 const jsonNull = 'null';
 
 const IdenticalPathPage:FC<IdenticalPathPageProps> = (props:IdenticalPathPageProps) => {

+ 6 - 3
packages/app/src/stores/ui.tsx

@@ -322,7 +322,8 @@ export const useIsAbleToShowPageManagement = (): SWRResponse<boolean, Error> =>
 
   return useSWRImmutable(
     includesUndefined ? null : key,
-    () => isPageExist! && !isTrashPage && !isSharedUser);
+    () => isPageExist! && !isTrashPage && !isSharedUser,
+  );
 };
 
 export const useIsAbleToShowTagLabel = (): SWRResponse<boolean, Error> => {
@@ -340,7 +341,8 @@ export const useIsAbleToShowTagLabel = (): SWRResponse<boolean, Error> => {
 
   return useSWRImmutable(
     includesUndefined ? null : key,
-    () => !isUserPage && !isSharedPage(currentPagePath!) && !isIdenticalPath && !(isViewMode && isNotFoundPage));
+    () => !isUserPage && !isSharedPage(currentPagePath!) && !isIdenticalPath && !(isViewMode && isNotFoundPage),
+  );
 };
 
 export const useIsAbleToShowPageEditorModeManager = (): SWRResponse<boolean, Error> => {
@@ -366,5 +368,6 @@ export const useIsAbleToShowPageAuthors = (): SWRResponse<boolean, Error> => {
 
   return useSWRImmutable(
     includesUndefined ? null : key,
-    () => isPageExist! && !isUserPage);
+    () => isPageExist! && !isUserPage,
+  );
 };