Shun Miyazawa 3 سال پیش
والد
کامیت
eeae73835e
1فایلهای تغییر یافته به همراه5 افزوده شده و 25 حذف شده
  1. 5 25
      packages/app/src/stores/context.tsx

+ 5 - 25
packages/app/src/stores/context.tsx

@@ -1,8 +1,8 @@
-import { pagePathUtils } from '@growi/core';
 import { HtmlElementNode } from 'rehype-toc';
 import { Key, SWRResponse } from 'swr';
 import useSWRImmutable from 'swr/immutable';
 
+
 import { SupportedActionType } from '~/interfaces/activity';
 import { EditorConfig } from '~/interfaces/editor-settings';
 // import { CustomWindow } from '~/interfaces/global';
@@ -18,8 +18,6 @@ import { useStaticSWR } from './use-static-swr';
 
 type Nullable<T> = T | null;
 
-const { isTrashPage, isTrashTopPage } = pagePathUtils;
-
 
 export const useInterceptorManager = (): SWRResponse<InterceptorManager, Error> => {
   return useStaticSWR<InterceptorManager, Error>('interceptorManager', undefined, { fallbackData: new InterceptorManager() });
@@ -85,6 +83,10 @@ export const useIsUserPage = (initialData?: boolean): SWRResponse<boolean, Error
   return useStaticSWR<boolean, Error>('isUserPage', initialData, { fallbackData: false });
 };
 
+export const useIsTrashPage = (initialData?: boolean): SWRResponse<boolean, Error> => {
+  return useStaticSWR<boolean, Error>('isTrashPage', initialData, { fallbackData: false });
+};
+
 export const useIsNotCreatable = (initialData?: boolean): SWRResponse<boolean, Error> => {
   return useStaticSWR<boolean, Error>('isNotCreatable', initialData, { fallbackData: false });
 };
@@ -271,28 +273,6 @@ export const useIsGuestUser = (): SWRResponse<boolean, Error> => {
   );
 };
 
-export const useIsTrashPage = (): SWRResponse<boolean, Error> => {
-  const { data: currentPagePath } = useCurrentPagePath();
-
-  const result = isTrashPage(currentPagePath || '');
-
-  return useSWRImmutable(
-    currentPagePath != null ? ['isTrashPage', result] : null,
-    (key: Key, isTrashPage: boolean) => isTrashPage,
-  );
-};
-
-export const useIsTrashTopPage = (): SWRResponse<boolean, Error> => {
-  const { data: currentPagePath } = useCurrentPagePath();
-
-  const result = isTrashTopPage(currentPagePath || '');
-
-  return useSWRImmutable(
-    currentPagePath != null ? ['isTrashTopPage', result] : null,
-    (key: Key, isTrashPage: boolean) => isTrashPage,
-  );
-};
-
 export const useIsEditable = (): SWRResponse<boolean, Error> => {
   const { data: isGuestUser } = useIsGuestUser();
   const { data: isNotCreatable } = useIsNotCreatable();