@elementor/editor-controls 4.2.0-946 → 4.2.0-beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4515,12 +4515,19 @@ function useQueryAutocomplete({
4515
4515
  ),
4516
4516
  [url, excludeIdSet]
4517
4517
  );
4518
+ (0, import_react42.useEffect)(() => {
4519
+ if (minInputLength === 0 && url) {
4520
+ fetchOptions(url, { ...params, term: "" }).then((newOptions) => {
4521
+ setOptions(formatOptions(filterExcludedOptions(newOptions, excludeIdSet)));
4522
+ });
4523
+ }
4524
+ }, [url, minInputLength, excludeIdSet, params]);
4518
4525
  const updateOptions = (term) => {
4519
- setOptions([]);
4520
- if (!term || !url || term.length < minInputLength) {
4526
+ const termStr = term ?? "";
4527
+ if (!url || termStr.length < minInputLength) {
4521
4528
  return;
4522
4529
  }
4523
- debounceFetch({ ...params, term });
4530
+ debounceFetch({ ...params, term: termStr });
4524
4531
  };
4525
4532
  return { options, updateOptions };
4526
4533
  }