jam411 3 anni fa
parent
commit
2905297cda

+ 2 - 1
packages/app/src/components/Navbar/GlobalSearch.tsx

@@ -46,10 +46,11 @@ export const GlobalSearch = (props: GlobalSearchProps): JSX.Element => {
     assert(data.length > 0);
 
     const page = data[0].data; // should be single page selected
+    const pagePath = page.path === '/' ? '/' : `/${page._id}`;
 
     // navigate to page
     if (page != null) {
-      router.push(`/${page._id}`);
+      router.push(pagePath);
     }
   }, [router]);
 

+ 2 - 2
packages/app/src/components/PageAlert/OldRevisionAlert.tsx

@@ -16,12 +16,12 @@ export const OldRevisionAlert = (): JSX.Element => {
     return <></>;
   }
 
-  const path = page.path === '/' ? '/' : `/${page._id}`;
+  const pathPath = page.path === '/' ? '/' : `/${page._id}`;
 
   return (
     <div className="alert alert-warning">
       <strong>{ t('Warning') }: </strong> { t('page_page.notice.version') }
-      <Link href={path}>
+      <Link href={pathPath}>
         <a><i className="icon-fw icon-arrow-right-circle"></i>{ t('Show latest') }</a>
       </Link>
     </div>

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

@@ -417,7 +417,7 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
   // Icon that draw attention from users for some actions
   const shouldShowAttentionIcon = page.processData != null ? shouldRecoverPagePaths(page.processData) : false;
 
-  const path = page.path === '/' ? '/' : `/${page._id}`;
+  const pathPath = page.path === '/' ? '/' : `/${page._id}`;
 
   return (
     <div
@@ -470,7 +470,7 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
                 </>
               )}
 
-              <Link href={path} prefetch={false}>
+              <Link href={pathPath} prefetch={false}>
                 <a className="grw-pagetree-title-anchor flex-grow-1">
                   <p className={`text-truncate m-auto ${page.isEmpty && 'grw-sidebar-text-muted'}`}>{nodePath.basename(page.path ?? '') || '/'}</p>
                 </a>