updated searchbar to retain state on refresh
All checks were successful
Vercel Production Deployment / Deploy-Production (push) Successful in 1m18s

This commit is contained in:
ChrQR 2024-05-28 14:10:56 +02:00
parent a61a65aab0
commit ef08c000ec

View File

@ -4,13 +4,14 @@ import { Input } from "~/components/ui/input";
import useFilterStore from "../store";
export default function SearchBar() {
const [searchQuery, setSearchQuery] = useState("");
const [query, setQuery] = useState("");
const setStoreSearchQuery = useFilterStore((state) => state.setSearchQuery);
const { searchQuery } = useFilterStore((state) => state.filters);
function handleInput(e: ChangeEvent<HTMLInputElement>) {
e.preventDefault();
const newValue = e.target.value;
setSearchQuery(newValue);
setQuery(newValue);
setStoreSearchQuery(newValue);
}
return (