filter
filter copied to clipboard
tuple field type not working with the `FilterBuilder` `simple` type
Hi, The following code:
const filterFields = [
{ id: "province", label: "Province", type: "text" },
{ id: "foc", label: "FOC", type: "tuple" }
];
async function filterOptions(fieldId: string) {
switch (fieldId) {
case "province":
return ["A", "B", "C"];
case "foc":
return ["All", "Is Not FOC", "Is FOC"];
default:
return [];
}
}
<FilterBuilder
type={"simple"}
fields={filterFields}
options={filterOptions}
value={filterValue}
/>
It raise the following error:
TypeError: Cannot read properties of undefined (reading 'id')
at xe._fixRule (index.js:1:11426)
at Array.<anonymous> (index.js:1:9895)
at ge.exec (index.js:1:5458)
at o (index.es.js:405:7)
at index.es.js:413:12
at p (index.es.js:253:19)
at onClick (index.es.js:134:49)
at index.es.js:42:5
at executeDispatch (react-dom-client.development.js:16368:9)
at runWithFiberInDEV (react-dom-client.development.js:1519:30)