Ver código fonte

20250530 20:39

taikou-m 10 meses atrás
pai
commit
79db193706

+ 3 - 5
apps/app/src/client/components/PageControls/PageControls.tsx

@@ -141,8 +141,6 @@ const PageControlsSubstance = (props: PageControlsSubstanceProps): JSX.Element =
   const { data: currentPagePath } = useCurrentPagePath();
   const { data: currentPagePath } = useCurrentPagePath();
 
 
   const isUsersHomepage = pagePathUtils.isUsersHomepage(currentPagePath ?? '');
   const isUsersHomepage = pagePathUtils.isUsersHomepage(currentPagePath ?? '');
-  console.log(isUsersHomepage);
-
 
 
   const { mutate: mutatePageInfo } = useSWRxPageInfo(pageId, shareLinkId);
   const { mutate: mutatePageInfo } = useSWRxPageInfo(pageId, shareLinkId);
 
 
@@ -289,7 +287,7 @@ const PageControlsSubstance = (props: PageControlsSubstanceProps): JSX.Element =
   const _isIPageInfoForOperation = isIPageInfoForOperation(pageInfo);
   const _isIPageInfoForOperation = isIPageInfoForOperation(pageInfo);
   const isViewMode = editorMode === EditorMode.View;
   const isViewMode = editorMode === EditorMode.View;
 
 
-  const isEnableActions = () => {
+  const isEnableActions = useMemo(() => {
     if (isGuestUser) {
     if (isGuestUser) {
       return false;
       return false;
     }
     }
@@ -299,7 +297,7 @@ const PageControlsSubstance = (props: PageControlsSubstanceProps): JSX.Element =
     }
     }
 
 
     return true;
     return true;
-  };
+  }, [isGuestUser, isUsersHomepage, isUsersHomepageDeletionEnabled]);
 
 
   return (
   return (
     <div className={`${styles['grw-page-controls']} hstack gap-2`} ref={pageControlsRef}>
     <div className={`${styles['grw-page-controls']} hstack gap-2`} ref={pageControlsRef}>
@@ -353,7 +351,7 @@ const PageControlsSubstance = (props: PageControlsSubstanceProps): JSX.Element =
         <PageItemControl
         <PageItemControl
           pageId={pageId}
           pageId={pageId}
           pageInfo={pageInfo}
           pageInfo={pageInfo}
-          isEnableActions={isEnableActions()}
+          isEnableActions={isEnableActions}
           isReadOnlyUser={!!isReadOnlyUser}
           isReadOnlyUser={!!isReadOnlyUser}
           forceHideMenuItems={forceHideMenuItemsWithAdditions}
           forceHideMenuItems={forceHideMenuItemsWithAdditions}
           additionalMenuItemOnTopRenderer={!isReadOnlyUser ? additionalMenuItemOnTopRenderer : undefined}
           additionalMenuItemOnTopRenderer={!isReadOnlyUser ? additionalMenuItemOnTopRenderer : undefined}