From 62f0dca0c7d522f83eac146734a0117ca183107f Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 23 Mar 2022 21:53:53 -0400 Subject: [PATCH] Memoize the search bar Closes #149 --- components/SearchBar.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/SearchBar.tsx b/components/SearchBar.tsx index 4f601174..2c14198b 100644 --- a/components/SearchBar.tsx +++ b/components/SearchBar.tsx @@ -17,6 +17,7 @@ import { SearchPanel, SearchPanelProps } from "./SearchPanel"; import { useAutocomplete } from "@lib/hooks/autocomplete"; import { AutocompleteItem } from "@lib/hooks/autocomplete"; import { Box } from "@chakra-ui/react"; +import React from "react"; const initialAutocompleteState: AutocompleteState = { collections: [], @@ -29,7 +30,7 @@ const initialAutocompleteState: AutocompleteState = { }; // Returns the search bar displayed in the header and the home page -export function SearchBar( +function SearchBar( props: Partial> & { overlay: boolean } ) { const [autocompleteState, setAutocompleteState] = useState< @@ -53,3 +54,5 @@ export function SearchBar( ); } + +export default React.memo(SearchBar);