[web] Fix dev mode error on search input (#1453)
## Description Ran into error after clearing search bar of queries by hitting backspace. > The error is shown below > Thank you to the team for considering ## Tests **Error** ![Screenshot 2024-04-15 184234](https://github.com/ente-io/ente/assets/82031202/f5f9845c-9420-4746-998b-2c67136d69cd) **Fix** Fixed by wrapping the line-causing error around by an `if` block.
This commit is contained in:
commit
020ed59d40
|
@ -56,8 +56,11 @@ 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();
|
||||||
};
|
};
|
||||||
const handleInputChange = (value: string, actionMeta: InputActionMeta) => {
|
const handleInputChange = (value: string, actionMeta: InputActionMeta) => {
|
||||||
|
|
Loading…
Reference in a new issue