When searching in the tasks and notes pages, the URL changes correctly and the content updates to show the correct data. However it reverts back to a no-search state after a couple of seconds.
`const [query, setQuery] = useState("");
const router = useRouter();
const searchParams = useSearchParams();
useEffect(() => {
const delayDebounceFn = setTimeout(() => {
let newUrl = "";
if (query) {
newUrl = formUrlQuery({
params: searchParams.toString(),
key: "query",
value: query,
});
} else {
newUrl = removeKeysFromQuery({
params: searchParams.toString(),
keysToRemove: ["query"],
});
}
router.push(newUrl, { scroll: false });
}, 300);
return () => clearTimeout(delayDebounceFn);
}, [query, searchParams, router]);`
When searching in the tasks and notes pages, the URL changes correctly and the content updates to show the correct data. However it reverts back to a no-search state after a couple of seconds.
`const [query, setQuery] = useState("");
const router = useRouter();
const searchParams = useSearchParams();
useEffect(() => {
const delayDebounceFn = setTimeout(() => {
let newUrl = "";
}, [query, searchParams, router]);`