Просмотр исходного кода

refactor useIsNotFoundPermalink

yuken 3 лет назад
Родитель
Сommit
bc5ddbf1ff

+ 0 - 6
packages/app/src/interfaces/page-listing-results.ts

@@ -22,12 +22,6 @@ export interface TargetAndAncestors {
   rootPage: Partial<IPageForItem>,
   rootPage: Partial<IPageForItem>,
 }
 }
 
 
-
-export interface IsNotFoundPermalink {
-  isNotFoundPermalink: boolean
-}
-
-
 export interface V5MigrationStatus {
 export interface V5MigrationStatus {
   isV5Compatible : boolean,
   isV5Compatible : boolean,
   migratablePagesCount: number
   migratablePagesCount: number

+ 1 - 1
packages/app/src/pages/[[...path]].page.tsx

@@ -106,7 +106,7 @@ const GrowiPage: NextPage<Props> = (props: Props) => {
   // useNotFound(props.isNotFound);
   // useNotFound(props.isNotFound);
   // useShareLinkId(props.shareLinkId);
   // useShareLinkId(props.shareLinkId);
   useIsSharedUser(props.currentUser == null); // '/shared' is not routed this page
   useIsSharedUser(props.currentUser == null); // '/shared' is not routed this page
-  useIsNotFoundPermalink({ isNotFoundPermalink: props.isNotFound });
+  useIsNotFoundPermalink(props.isNotFound ?? false);
   useIsIdenticalPath(false); // TODO: need to initialize from props
   useIsIdenticalPath(false); // TODO: need to initialize from props
   // useIsAbleToDeleteCompletely(props.isAbleToDeleteCompletely);
   // useIsAbleToDeleteCompletely(props.isAbleToDeleteCompletely);
   // useIsSharedUser(props.currentUser == null && isSharedPage(props.currentPagePath));
   // useIsSharedUser(props.currentUser == null && isSharedPage(props.currentPagePath));

+ 3 - 3
packages/app/src/stores/context.tsx

@@ -3,7 +3,7 @@ import { Key, SWRResponse } from 'swr';
 import useSWRImmutable from 'swr/immutable';
 import useSWRImmutable from 'swr/immutable';
 
 
 
 
-import { TargetAndAncestors, IsNotFoundPermalink } from '../interfaces/page-listing-results';
+import { TargetAndAncestors } from '../interfaces/page-listing-results';
 import { IUser } from '../interfaces/user';
 import { IUser } from '../interfaces/user';
 
 
 import { useStaticSWR } from './use-static-swr';
 import { useStaticSWR } from './use-static-swr';
@@ -152,8 +152,8 @@ export const useNotFoundTargetPathOrId = (initialData?: string): SWRResponse<str
   return useStaticSWR<string, Error>('notFoundTargetPathOrId', initialData);
   return useStaticSWR<string, Error>('notFoundTargetPathOrId', initialData);
 };
 };
 
 
-export const useIsNotFoundPermalink = (initialData?: Nullable<IsNotFoundPermalink>): SWRResponse<Nullable<IsNotFoundPermalink>, Error> => {
-  return useStaticSWR<Nullable<IsNotFoundPermalink>, Error>('isNotFoundPermalink', initialData);
+export const useIsNotFoundPermalink = (initialData?: Nullable<boolean>): SWRResponse<Nullable<boolean>, Error> => {
+  return useStaticSWR<Nullable<boolean>, Error>('isNotFoundPermalink', initialData);
 };
 };
 
 
 export const useIsAclEnabled = (initialData?: boolean) : SWRResponse<boolean, Error> => {
 export const useIsAclEnabled = (initialData?: boolean) : SWRResponse<boolean, Error> => {