ソースを参照

fix: router replace in Explore page (#4918)

Nam Vu 10 ヶ月 前
コミット
c212700341
1 ファイル変更4 行追加2 行削除
  1. 4 2
      web/app/components/share/text-generation/index.tsx

+ 4 - 2
web/app/components/share/text-generation/index.tsx

@@ -80,8 +80,10 @@ const TextGeneration: FC<IMainProps> = ({
   const pathname = usePathname()
   useEffect(() => {
     const params = new URLSearchParams(searchParams)
-    params.delete('mode')
-    router.replace(`${pathname}?${params.toString()}`)
+    if (params.has('mode')) {
+      params.delete('mode')
+      router.replace(`${pathname}?${params.toString()}`)
+    }
     // eslint-disable-next-line react-hooks/exhaustive-deps
   }, [])