From 02a5b35a30845268cfaa814bb045d0ec800dc538 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Sat, 12 Oct 2024 13:21:40 +0000 Subject: fix(web): Reset search query and bulk edit when navigating away from the current page --- apps/web/lib/hooks/bookmark-search.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'apps/web/lib') diff --git a/apps/web/lib/hooks/bookmark-search.ts b/apps/web/lib/hooks/bookmark-search.ts index 8514deb6..ffdf402d 100644 --- a/apps/web/lib/hooks/bookmark-search.ts +++ b/apps/web/lib/hooks/bookmark-search.ts @@ -1,5 +1,5 @@ import { useEffect, useState } from "react"; -import { useRouter, useSearchParams } from "next/navigation"; +import { usePathname, useRouter, useSearchParams } from "next/navigation"; import { api } from "@/lib/trpc"; import { keepPreviousData } from "@tanstack/react-query"; @@ -13,6 +13,7 @@ export function useDoBookmarkSearch() { const router = useRouter(); const { searchQuery } = useSearchQuery(); const [timeoutId, setTimeoutId] = useState(); + const pathname = usePathname(); useEffect(() => { return () => { @@ -42,6 +43,7 @@ export function useDoBookmarkSearch() { doSearch, debounceSearch, searchQuery, + isInSearchPage: pathname.startsWith("/dashboard/search"), }; } -- cgit v1.2.3-70-g09d2