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

implement decode in redirect function

yuken 3 лет назад
Родитель
Сommit
827f45f27d
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      packages/app/src/pages/[[...path]].page.tsx

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

@@ -252,7 +252,8 @@ const GrowiPage: NextPage<Props> = (props: Props) => {
 
 
   // sync pathname by Shallow Routing https://nextjs.org/docs/routing/shallow-routing
   // sync pathname by Shallow Routing https://nextjs.org/docs/routing/shallow-routing
   useEffect(() => {
   useEffect(() => {
-    if (isClient() && window.location.pathname !== props.currentPathname) {
+    const decodedURI = decodeURI(window.location.pathname);
+    if (isClient() && decodedURI !== props.currentPathname) {
       router.replace(props.currentPathname, undefined, { shallow: true });
       router.replace(props.currentPathname, undefined, { shallow: true });
     }
     }
   }, [props.currentPathname, router]);
   }, [props.currentPathname, router]);