@elementor/editor-controls 4.3.0-953 → 4.3.0-955
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 +10 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
- package/src/hooks/use-query-autocomplete.ts +13 -5
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
|
-
|
|
4520
|
-
if (!
|
|
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
|
}
|