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

+ 4 - 6
packages/app/src/components/NotFoundPage.tsx

@@ -14,11 +14,9 @@ import PageTimeline from './PageTimeline';
 /**
  * Replace url in address bar with new path and query parameters
  */
-const replaceURLHistory = (pageId: string, path: string) => {
-  if (pageId != null) {
-    const queryParameters = window.location.search;
-    window.history.replaceState(null, '', urljoin(path, queryParameters));
-  }
+const replaceURLHistory = (path: string) => {
+  const queryParameters = window.location.search;
+  window.history.replaceState(null, '', urljoin(path, queryParameters));
 };
 
 const NotFoundPage = (): JSX.Element => {
@@ -29,7 +27,7 @@ const NotFoundPage = (): JSX.Element => {
   // replace url in address bar
   useEffect(() => {
     if (pageId == null || path == null) return;
-    replaceURLHistory(pageId, path);
+    replaceURLHistory(path);
   }, [pageId, path]);
 
   const navTabMapping = useMemo(() => {