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

replace permalink with page path in addressbar

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

+ 11 - 2
packages/app/src/components/NotFoundPage.tsx

@@ -1,15 +1,24 @@
 import React, { useMemo } from 'react';
 import React, { useMemo } from 'react';
+
 import { useTranslation } from 'react-i18next';
 import { useTranslation } from 'react-i18next';
 
 
-import PageListIcon from './Icons/PageListIcon';
-import TimeLineIcon from './Icons/TimeLineIcon';
+import { useCurrentPageId, useCurrentPagePath } from '~/stores/context';
+
 import CustomNavAndContents from './CustomNavigation/CustomNavAndContents';
 import CustomNavAndContents from './CustomNavigation/CustomNavAndContents';
 import { DescendantsPageListForCurrentPath } from './DescendantsPageList';
 import { DescendantsPageListForCurrentPath } from './DescendantsPageList';
+import PageListIcon from './Icons/PageListIcon';
+import TimeLineIcon from './Icons/TimeLineIcon';
 import PageTimeline from './PageTimeline';
 import PageTimeline from './PageTimeline';
 
 
 
 
 const NotFoundPage = (): JSX.Element => {
 const NotFoundPage = (): JSX.Element => {
   const { t } = useTranslation();
   const { t } = useTranslation();
+  const { data: pageId } = useCurrentPageId();
+  const { data: path } = useCurrentPagePath();
+
+  if (pageId != null) {
+    window.history.replaceState(null, '', path);
+  }
 
 
   const navTabMapping = useMemo(() => {
   const navTabMapping = useMemo(() => {
     return {
     return {