[web] Clear search bar state when value is falsey
Updates https://github.com/ente-io/ente/pull/1453 so that we also clear the existing state by calling the setFoo methods even when value is falsey.
This commit is contained in:
parent
020ed59d40
commit
d7b0beb949
|
@ -56,10 +56,8 @@ export default function SearchInput(props: Iprops) {
|
||||||
const [value, setValue] = useState<SearchOption>(null);
|
const [value, setValue] = useState<SearchOption>(null);
|
||||||
const appContext = useContext(AppContext);
|
const appContext = useContext(AppContext);
|
||||||
const handleChange = (value: SearchOption) => {
|
const handleChange = (value: SearchOption) => {
|
||||||
if (value) {
|
|
||||||
setValue(value);
|
setValue(value);
|
||||||
setQuery(value.label);
|
setQuery(value?.label);
|
||||||
}
|
|
||||||
|
|
||||||
blur();
|
blur();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue