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) => {
setFetch(true);
await methods.triggerEvent({ name: 'onSearch', event: { value } });
setFetch(false);
const result = await methods.triggerEvent({ name: 'onSearch', event: { value } });
if (!result.bounced) {
setFetch(false);
}
}}
>
{uniqueValueOptions.map((opt, i) =>

View File

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