Blueprints: Set blueprintSearchInput as undefined with empty string

This dispatches changes to `blueprintSearchInput` and sets it as `undefined` when the value is an empty string.
This commit is contained in:
regexowl 2024-09-23 14:02:16 +02:00 committed by Sanne Raymaekers
parent e051aa3f7f
commit 49162e01f5

View file

@ -168,7 +168,11 @@ const BlueprintSearch = ({ blueprintsTotal }: blueprintSearchProps) => {
};
}, [debouncedSearch]);
const onChange = (value: string) => {
debouncedSearch(value);
if (value.length === 0) {
dispatch(setBlueprintSearchInput(undefined));
} else {
debouncedSearch(value);
}
};
return (