ryoji-s 2 лет назад
Родитель
Сommit
f9568fa92c
1 измененных файлов с 8 добавлено и 3 удалено
  1. 8 3
      apps/app/src/components/PageSideContents.tsx

+ 8 - 3
apps/app/src/components/PageSideContents.tsx

@@ -4,6 +4,7 @@ import { IPageHasId, pagePathUtils } from '@growi/core';
 import { useTranslation } from 'next-i18next';
 import { useTranslation } from 'next-i18next';
 import { Link } from 'react-scroll';
 import { Link } from 'react-scroll';
 
 
+import { IPageInfoForOperation } from '~/interfaces/page';
 import { useDescendantsPageListModal } from '~/stores/modal';
 import { useDescendantsPageListModal } from '~/stores/modal';
 import { useSWRxPageInfo } from '~/stores/page';
 import { useSWRxPageInfo } from '~/stores/page';
 
 
@@ -30,7 +31,7 @@ export const PageSideContents = (props: PageSideContentsProps): JSX.Element => {
 
 
   const { page, isSharedUser } = props;
   const { page, isSharedUser } = props;
 
 
-  const { data: pageInfo } = useSWRxPageInfo(page.id);
+  const { data: pageInfo } = useSWRxPageInfo(page._id);
 
 
   const pagePath = page.path;
   const pagePath = page.path;
   const isTopPagePath = isTopPage(pagePath);
   const isTopPagePath = isTopPage(pagePath);
@@ -54,7 +55,9 @@ export const PageSideContents = (props: PageSideContentsProps): JSX.Element => {
             {t('page_list')}
             {t('page_list')}
 
 
             {/* Do not display CountBadge if '/trash/*': https://github.com/weseek/growi/pull/7600 */}
             {/* Do not display CountBadge if '/trash/*': https://github.com/weseek/growi/pull/7600 */}
-            { !isTrash ? <CountBadge count={pageInfo.descendantCount} offset={1} /> : <div className='px-2'></div>}
+            { !isTrash && pageInfo != null
+              ? <CountBadge count={(pageInfo as IPageInfoForOperation).descendantCount} offset={1} />
+              : <div className='px-2'></div>}
           </button>
           </button>
         )}
         )}
       </div>
       </div>
@@ -70,7 +73,9 @@ export const PageSideContents = (props: PageSideContentsProps): JSX.Element => {
             >
             >
               <i className="icon-fw icon-bubbles grw-page-accessories-control-icon"></i>
               <i className="icon-fw icon-bubbles grw-page-accessories-control-icon"></i>
               <span>Comments</span>
               <span>Comments</span>
-              <CountBadge count={pageInfo.commentCount} />
+              { pageInfo != null
+                ? <CountBadge count={(pageInfo as IPageInfoForOperation).commentCount} />
+                : <div className='px-2'></div>}
             </button>
             </button>
           </Link>
           </Link>
         </div>
         </div>