From aaa4727bc0b75dd266a8bf12f93ec92cae024d55 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Mon, 9 Sep 2024 15:27:36 +0530 Subject: [PATCH] Inline --- web/apps/photos/src/components/SearchBar.tsx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/web/apps/photos/src/components/SearchBar.tsx b/web/apps/photos/src/components/SearchBar.tsx index 1b40e5292b..52c6b1a0cb 100644 --- a/web/apps/photos/src/components/SearchBar.tsx +++ b/web/apps/photos/src/components/SearchBar.tsx @@ -119,22 +119,22 @@ const createComponents = memoize((Option, ValueContainer, Menu, Input) => ({ })); const SearchInput: React.FC = (props) => { - const selectRef = useRef(null); - const [value, setValue] = useState(null); const appContext = useContext(AppContext); + const [value, setValue] = useState(null); + const selectRef = useRef(null); + const [defaultOptions, setDefaultOptions] = useState([]); + const [query, setQuery] = useState(""); + const handleChange = (value: SearchOption) => { setValue(value); setQuery(value?.label); - - blur(); + selectRef.current?.blur(); }; const handleInputChange = (value: string, actionMeta: InputActionMeta) => { if (actionMeta.action === "input-change") { setQuery(value); } }; - const [defaultOptions, setDefaultOptions] = useState([]); - const [query, setQuery] = useState(""); useEffect(() => { search(value); @@ -172,10 +172,6 @@ const SearchInput: React.FC = (props) => { [props.files, props.collections], ); - const blur = () => { - selectRef.current?.blur(); - }; - const search = (selectedOption: SearchOption) => { if (!selectedOption) { return;