fix(blocks-antd): Added debounce condition to Selector and MultipleSelector

This commit is contained in:
Sandile 2021-11-29 10:01:08 +02:00
parent 28b9ebdbf1
commit 910bee0837
2 changed files with 8 additions and 4 deletions

View File

@ -110,8 +110,10 @@ const MultipleSelector = ({
}} }}
onSearch={async (value) => { onSearch={async (value) => {
setFetch(true); setFetch(true);
await methods.triggerEvent({ name: 'onSearch', event: { value } }); const result = await methods.triggerEvent({ name: 'onSearch', event: { value } });
setFetch(false); if (!result.bounced) {
setFetch(false);
}
}} }}
> >
{uniqueValueOptions.map((opt, i) => {uniqueValueOptions.map((opt, i) =>

View File

@ -98,8 +98,10 @@ const Selector = ({
}} }}
onSearch={async (value) => { onSearch={async (value) => {
setFetch(true); setFetch(true);
await methods.triggerEvent({ name: 'onSearch', event: { value } }); const result = await methods.triggerEvent({ name: 'onSearch', event: { value } });
setFetch(false); if (!result.bounced) {
setFetch(false);
}
}} }}
value={getValueIndex(value, uniqueValueOptions)} value={getValueIndex(value, uniqueValueOptions)}
> >