indicator-ui 0.0.66 → 0.0.67
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
|
@@ -9539,19 +9539,30 @@ function SelectField({ value, onChange, options = [], placeholder, isError, sear
|
|
|
9539
9539
|
return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_FlexField__WEBPACK_IMPORTED_MODULE_2__.FlexField, { value: (0,_lib__WEBPACK_IMPORTED_MODULE_3__.getStringValue)(value, optionsCacheRef.current), isError: isError, disabled: disabled, placeholder: placeholder, notInput: true, onClick: () => setIsShowModalWindow(true), dropdown: true, dropdownState: isShowModalWindow, ref: inputRef });
|
|
9540
9540
|
};
|
|
9541
9541
|
const processLoadMoreOptions = async () => {
|
|
9542
|
-
|
|
9543
|
-
if (requestPromise !== undefined)
|
|
9542
|
+
if (requestPromiseRef.current)
|
|
9544
9543
|
return;
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
requestPromiseRef.current =
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9544
|
+
try {
|
|
9545
|
+
const promise = loadMoreOptions?.(optionsState.length, searchingString);
|
|
9546
|
+
if (!promise)
|
|
9547
|
+
return;
|
|
9548
|
+
requestPromiseRef.current = promise;
|
|
9549
|
+
const newOptions = await promise;
|
|
9550
|
+
// Ждём обновления состояния и только потом сбрасываем промис
|
|
9551
|
+
setOptionsState(prev => {
|
|
9552
|
+
const updatedOptions = newOptions ? [...prev, ...newOptions] : prev;
|
|
9553
|
+
// Важно: сброс происходит внутри колбэка setState!
|
|
9554
|
+
setTimeout(() => {
|
|
9555
|
+
requestPromiseRef.current = undefined;
|
|
9556
|
+
}, 0);
|
|
9557
|
+
return updatedOptions;
|
|
9558
|
+
});
|
|
9559
|
+
}
|
|
9560
|
+
catch (error) {
|
|
9561
|
+
// Сбрасываем даже при ошибке
|
|
9562
|
+
setTimeout(() => {
|
|
9563
|
+
requestPromiseRef.current = undefined;
|
|
9564
|
+
}, 0);
|
|
9565
|
+
}
|
|
9555
9566
|
};
|
|
9556
9567
|
const onScrollToBottom = async () => {
|
|
9557
9568
|
onBottomScroll && onBottomScroll();
|