yohei0125 3 лет назад
Родитель
Сommit
ccf46ab304
1 измененных файлов с 6 добавлено и 3 удалено
  1. 6 3
      packages/app/src/components/Page/FixPageGrantAlert.tsx

+ 6 - 3
packages/app/src/components/Page/FixPageGrantAlert.tsx

@@ -9,7 +9,9 @@ import { toastError, toastSuccess } from '~/client/util/apiNotification';
 import { apiv3Put } from '~/client/util/apiv3-client';
 import { PageGrant, IPageGrantData } from '~/interfaces/page';
 import { IRecordApplicableGrant, IResIsGrantNormalizedGrantData } from '~/interfaces/page-grant';
-import { useCurrentPageId, useCurrentUser, useHasParent } from '~/stores/context';
+import {
+  useCurrentPageId, useCurrentUser, useHasParent, useIsEmptyPageInNotFoundContext,
+} from '~/stores/context';
 import { useSWRxApplicableGrant, useSWRxIsGrantNormalized } from '~/stores/page';
 
 type ModalProps = {
@@ -234,11 +236,12 @@ const FixPageGrantAlert = (): JSX.Element => {
   const { data: currentUser } = useCurrentUser();
   const { data: pageId } = useCurrentPageId();
   const { data: hasParent } = useHasParent();
+  const { data: isEmptyPage } = useIsEmptyPageInNotFoundContext();
 
   const [isOpen, setOpen] = useState<boolean>(false);
 
-  const { data: dataIsGrantNormalized } = useSWRxIsGrantNormalized(currentUser != null ? pageId : null);
-  const { data: dataApplicableGrant } = useSWRxApplicableGrant(currentUser != null ? pageId : null);
+  const { data: dataIsGrantNormalized } = useSWRxIsGrantNormalized(currentUser != null && !isEmptyPage ? pageId : null);
+  const { data: dataApplicableGrant } = useSWRxApplicableGrant(currentUser != null && !isEmptyPage ? pageId : null);
 
   // Dependencies
   if (!hasParent) {