fix: router replace in Explore page (#4918)

This commit is contained in:
Nam Vu 2024-06-04 18:41:54 +07:00 committed by GitHub
parent e121788ff5
commit c212700341
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
}, [])