소스 검색

fix: router replace in Explore page (#4918)

Nam Vu 11 달 전
부모
커밋
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
   }, [])