From c212700341892c0b449fc09aee01775528d8aabb Mon Sep 17 00:00:00 2001 From: Nam Vu Date: Tue, 4 Jun 2024 18:41:54 +0700 Subject: [PATCH] fix: router replace in Explore page (#4918) --- web/app/components/share/text-generation/index.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/app/components/share/text-generation/index.tsx b/web/app/components/share/text-generation/index.tsx index 21ff2b051..79690275d 100644 --- a/web/app/components/share/text-generation/index.tsx +++ b/web/app/components/share/text-generation/index.tsx @@ -80,8 +80,10 @@ const TextGeneration: FC = ({ 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 }, [])