added mobile category page
This commit is contained in:
@@ -49,20 +49,18 @@ export default function SearchBar({
|
||||
}, [searchParams, pathname]);
|
||||
|
||||
React.useEffect(() => {
|
||||
// Debounce updates to the URL query when typing on search page
|
||||
if (pathname?.includes("/search")) {
|
||||
const delayDebounceFn = setTimeout(() => {
|
||||
const q = searchParams?.get("q") || "";
|
||||
const curVal = searchValue.trim();
|
||||
if (curVal !== q && curVal !== "") {
|
||||
router.push(`/${locale}/search?q=${encodeURIComponent(curVal)}`);
|
||||
} else if (curVal === "" && q !== "") {
|
||||
router.push(`/${locale}/search`);
|
||||
}
|
||||
}, 500);
|
||||
// Debounce updates to the URL query when typing
|
||||
const delayDebounceFn = setTimeout(() => {
|
||||
const q = searchParams?.get("q") || "";
|
||||
const curVal = searchValue.trim();
|
||||
if (curVal !== q && curVal !== "") {
|
||||
router.push(`/${locale}/search?q=${encodeURIComponent(curVal)}`);
|
||||
} else if (curVal === "" && q !== "" && pathname?.includes("/search")) {
|
||||
router.push(`/${locale}/search`);
|
||||
}
|
||||
}, 500);
|
||||
|
||||
return () => clearTimeout(delayDebounceFn);
|
||||
}
|
||||
return () => clearTimeout(delayDebounceFn);
|
||||
}, [searchValue, pathname, router, locale, searchParams]);
|
||||
|
||||
const performSearch = () => {
|
||||
|
||||
Reference in New Issue
Block a user