Open garryismael opened 1 week ago
When i test my custom hooks, it failed after adding scroll options. If i remove it, the test passed
export const useFilter = () => { const router = useRouter(); const pathname = usePathname(); const searchParams = useSearchParams(); const search = searchParams.get("search"); const clearFilter = () => { router.push(pathname, { scroll: false, }); }; const createQueryString = useCallback( (name, value) => { const params = new URLSearchParams(searchParams.toString()); params.set(name, value); return params.toString(); }, [searchParams] ); const changeSearchQuery = (key, value) => { router.push(pathname + "?" + createQueryString(key, value), { scroll: false, }); }; return { search, changeSearchQuery, clearFilter }; };
When i test my custom hooks, it failed after adding scroll options. If i remove it, the test passed