Support no_value operator type

Summary: Project doc: https://docs.google.com/document/d/1miofxds9DJgWScj0zFyBbdpRH5Rj0T9FqiCapof5-vU

Reviewed By: lblasa

Differential Revision: D48605550

fbshipit-source-id: 3c555c5cf2928e2a87686dff4c68516338203197
This commit is contained in:
Andrey Goncharov
2023-08-30 07:26:35 -07:00
committed by Facebook GitHub Bot
parent f16ff8ade4
commit f9d5d713ef

View File

@@ -79,6 +79,11 @@ export const PowerSearchTerm: React.FC<PowerSearchTermProps> = ({
);
break;
}
case 'NO_VALUE': {
// Nothing needs to be done. The effect below is going to fire and mark it as the final value.
searchValueInputComponent = null;
break;
}
default: {
console.error(
'PowerSearchTerm -> unknownoperator.valueType',
@@ -88,6 +93,15 @@ export const PowerSearchTerm: React.FC<PowerSearchTermProps> = ({
}
}
React.useEffect(() => {
if (searchTerm.operator.valueType === 'NO_VALUE') {
onFinalize({
...searchTerm,
searchValue: null,
});
}
}, [searchTerm, onFinalize]);
return (
<Space.Compact block size="small">
<Button>{searchTerm.field.label}</Button>