From ef08c000ec1d29de5f52e69f9c93ead5774ec4bc Mon Sep 17 00:00:00 2001 From: ChrQR Date: Tue, 28 May 2024 14:10:56 +0200 Subject: [PATCH] updated searchbar to retain state on refresh --- src/app/_components/SearchBar.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/_components/SearchBar.tsx b/src/app/_components/SearchBar.tsx index 7b26b91..14fc88d 100644 --- a/src/app/_components/SearchBar.tsx +++ b/src/app/_components/SearchBar.tsx @@ -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) { e.preventDefault(); const newValue = e.target.value; - setSearchQuery(newValue); + setQuery(newValue); setStoreSearchQuery(newValue); } return (