indicator-ui 0.0.39 → 0.0.40

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
@@ -9236,7 +9236,7 @@ __webpack_require__.r(__webpack_exports__);
9236
9236
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9237
9237
  /* harmony export */ DELTA_SCROLL_END: () => (/* binding */ DELTA_SCROLL_END)
9238
9238
  /* harmony export */ });
9239
- const DELTA_SCROLL_END = 10;
9239
+ const DELTA_SCROLL_END = 1;
9240
9240
 
9241
9241
 
9242
9242
  /***/ }),
@@ -9445,6 +9445,7 @@ function SelectField({ value, onChange, options = [], placeholder, isError, sear
9445
9445
  const [isFocus, setIsFocus] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false);
9446
9446
  const [searchingString, setSearchingString] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)('');
9447
9447
  const [isShowModalWindow, setIsShowModalWindow] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false);
9448
+ const requestPromiseRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(undefined);
9448
9449
  // Добавляем кэширование выбранных options
9449
9450
  const optionsCacheRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)([]);
9450
9451
  const [optionsState, setOptionsState] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(options);
@@ -9502,7 +9503,14 @@ function SelectField({ value, onChange, options = [], placeholder, isError, sear
9502
9503
  };
9503
9504
  const onScrollToBottom = async () => {
9504
9505
  if (loadMoreOptions) {
9505
- const newOptions = await loadMoreOptions(optionsState?.length || 0, searchingString);
9506
+ const requestPromise = requestPromiseRef.current;
9507
+ if (requestPromise === undefined) {
9508
+ requestPromiseRef.current = loadMoreOptions(optionsState?.length || 0, searchingString);
9509
+ }
9510
+ const newOptions = await requestPromiseRef.current;
9511
+ if (requestPromise === undefined || requestPromise === requestPromiseRef.current) {
9512
+ requestPromiseRef.current = undefined;
9513
+ }
9506
9514
  if (newOptions !== undefined)
9507
9515
  setOptionsState(prevState => [...prevState, ...newOptions]);
9508
9516
  }
@@ -9590,6 +9598,7 @@ function SelectModalWindow({ value, onChange, options, onScrollToBottom, afterEl
9590
9598
  const scrollHeight = event.currentTarget.scrollHeight;
9591
9599
  const clientHeight = event.currentTarget.clientHeight;
9592
9600
  const scrollTop = event.currentTarget.scrollTop;
9601
+ console.log('catch');
9593
9602
  if (scrollHeight - scrollTop - clientHeight < _config__WEBPACK_IMPORTED_MODULE_2__.DELTA_SCROLL_END) {
9594
9603
  onScrollToBottom && onScrollToBottom();
9595
9604
  }