From b8f2f216a3f70fab4cf3b1128250756ba71a0ee1 Mon Sep 17 00:00:00 2001 From: trafficlunar Date: Sat, 19 Jul 2025 17:47:28 +0100 Subject: [PATCH] fix: navigating to other pages redirects back --- src/components/mii-list/tag-filter.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/mii-list/tag-filter.tsx b/src/components/mii-list/tag-filter.tsx index a847ec1..caa0177 100644 --- a/src/components/mii-list/tag-filter.tsx +++ b/src/components/mii-list/tag-filter.tsx @@ -23,6 +23,11 @@ export default function TagFilter() { const [tags, setTags] = useState(preexistingTags); + // Sync state if the URL tags change (e.g. via navigation) + useEffect(() => { + setTags(preexistingTags); + }, [preexistingTags]); + // Redirect automatically on tags change useEffect(() => { const urlTags = preexistingTags.join(","); @@ -40,7 +45,8 @@ export default function TagFilter() { startTransition(() => { router.push(`?${params.toString()}`); }); - }, [tags, preexistingTags, searchParams, router]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [tags]); return (