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

Merge branch 'feat/redner-page-redirect-alert' into feat/unlink-pages

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

+ 3 - 3
packages/app/src/components/PageAlert/PageRedirectedAlert.tsx

@@ -7,16 +7,16 @@ import { useCurrentPagePath, useRedirectFrom } from '~/stores/context';
 
 export const PageRedirectedAlert = React.memo((): JSX.Element => {
   const { t } = useTranslation();
-
-  const { data: redirectFrom } = useRedirectFrom();
   const { data: currentPagePath } = useCurrentPagePath();
+  const { data: redirectFrom, mutate: mutateRedirectFrom } = useRedirectFrom();
 
   const [isUnlinked, setIsUnlinked] = useState(false);
 
   const unlinkButtonClickHandler = useCallback(() => {
     apiPost('/pages.unlink', { path: currentPagePath });
     setIsUnlinked(true);
-  }, [currentPagePath]);
+    mutateRedirectFrom('');
+  }, [currentPagePath, mutateRedirectFrom]);
 
   if (redirectFrom == null) {
     return <></>;