Yuki Takei 7 месяцев назад
Родитель
Сommit
4b53547f9e

+ 2 - 2
apps/app/src/client/components/PageEditor/EditorNavbarBottom/GrantSelector.tsx

@@ -62,11 +62,11 @@ export const GrantSelector = (props: Props): JSX.Element => {
 
   const [isSelectGroupModalShown, setIsSelectGroupModalShown] = useState(false);
 
-  const [currentUser] = useCurrentUser();
+  const currentUser = useCurrentUser();
 
   const shouldFetch = isSelectGroupModalShown;
   const { data: selectedGrant, mutate: mutateSelectedGrant } = useSelectedGrant();
-  const [currentPageId] = useCurrentPageId();
+  const currentPageId = useCurrentPageId();
   const { data: grantData } = useSWRxCurrentGrantData(currentPageId);
 
   const currentPageGrantData = grantData?.grantData.currentPageGrant;

+ 5 - 4
apps/app/src/client/components/TrashPageList.tsx

@@ -1,13 +1,14 @@
 import React, { useMemo, useCallback, type JSX } from 'react';
 
 import type { IPageHasId } from '@growi/core';
+import { useAtomValue } from 'jotai';
 import { useTranslation } from 'next-i18next';
 import dynamic from 'next/dynamic';
 
 import { toastSuccess } from '~/client/util/toastr';
 import type { IPagingResult } from '~/interfaces/paging-result';
 import { useIsReadOnlyUser } from '~/states/context';
-import { useShowPageLimitationXL } from '~/states/server-configurations';
+import { showPageLimitationXLAtom } from '~/states/server-configurations';
 import { useEmptyTrashModal } from '~/stores/modal';
 import { useSWRxPageInfoForList, useSWRxPageList } from '~/stores/page-listing';
 
@@ -26,8 +27,8 @@ const convertToIDataWithMeta = (page) => {
 const useEmptyTrashButton = () => {
 
   const { t } = useTranslation();
-  const [limit] = useShowPageLimitationXL();
-  const [isReadOnlyUser] = useIsReadOnlyUser();
+  const limit = useAtomValue(showPageLimitationXLAtom);
+  const isReadOnlyUser = useIsReadOnlyUser();
   const { data: pagingResult, mutate: mutatePageLists } = useSWRxPageList('/trash', 1, limit);
   const { open: openEmptyTrashModal } = useEmptyTrashModal();
 
@@ -64,7 +65,7 @@ const useEmptyTrashButton = () => {
 };
 
 const DescendantsPageListForTrash = (): JSX.Element => {
-  const [limit] = useShowPageLimitationXL();
+  const limit = useAtomValue(showPageLimitationXLAtom);
 
   return (
     <DescendantsPageList

+ 3 - 3
apps/app/src/components/PageView/PageAlerts/TrashPageAlert.tsx

@@ -27,15 +27,15 @@ export const TrashPageAlert = (): JSX.Element => {
   const router = useRouter();
 
   const { data: isAbleToShowTrashPageManagementButtons } = useIsAbleToShowTrashPageManagementButtons();
-  const [pageData] = useCurrentPageData();
-  const [isTrashPage] = useIsTrashPage();
+  const pageData = useCurrentPageData();
+  const isTrashPage = useIsTrashPage();
   const pageId = pageData?._id;
   const pagePath = pageData?.path;
   const { data: pageInfo } = useSWRxPageInfo(pageId ?? null);
 
   const { open: openDeleteModal } = usePageDeleteModal();
   const { open: openPutBackPageModal } = usePutBackPageModal();
-  const [currentPagePath] = useCurrentPagePath();
+  const currentPagePath = useCurrentPagePath();
 
   const { fetchCurrentPage } = useFetchCurrentPage();