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

BugFix: update useRedirectFrom

Yuki Takei 3 лет назад
Родитель
Сommit
55e20c78de

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

@@ -221,7 +221,7 @@ const Page: NextPageWithLayout<Props> = (props: Props) => {
   useIsForbidden(props.isForbidden);
   useIsNotFound(props.isNotFound);
   useIsNotCreatable(props.isNotCreatable);
-  useRedirectFrom(props.redirectFrom);
+  useRedirectFrom(props.redirectFrom ?? null);
   useIsSharedUser(false); // this page cann't be routed for '/share'
   useIsIdenticalPath(props.isIdenticalPathPage ?? false);
   useIsEnabledStaleNotification(props.isEnabledStaleNotification);

+ 1 - 1
packages/app/src/stores/page-redirect.tsx

@@ -3,6 +3,6 @@ import { SWRResponse } from 'swr';
 import { useStaticSWR } from './use-static-swr';
 
 
-export const useRedirectFrom = (initialData?: string): SWRResponse<string, Error> => {
+export const useRedirectFrom = (initialData?: string | null): SWRResponse<string | null, Error> => {
   return useStaticSWR('redirectFrom', initialData);
 };