indicator-ui 0.0.111 → 0.0.113

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
@@ -10094,7 +10094,7 @@ function SelectField({ value, onChange, options = [], placeholder, isError, sear
10094
10094
  const [isShowModalWindow, setIsShowModalWindow] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false);
10095
10095
  const requestPromiseRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(undefined);
10096
10096
  // Добавляем кэширование выбранных options
10097
- const optionsCacheRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)([]);
10097
+ const optionsCacheRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(options);
10098
10098
  const [optionsState, setOptionsState] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(options);
10099
10099
  const inputRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
10100
10100
  const searchingTimeoutRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
@@ -10106,7 +10106,11 @@ function SelectField({ value, onChange, options = [], placeholder, isError, sear
10106
10106
  }
10107
10107
  };
10108
10108
  }, []);
10109
+ const fillOptionsCache = (data) => {
10110
+ optionsCacheRef.current = data.length > 0 ? optionsState.filter(item => data.includes(item.value)) : optionsState;
10111
+ };
10109
10112
  (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
10113
+ fillOptionsCache(value);
10110
10114
  if (!offInitLoadMoreOptions) {
10111
10115
  onScrollToBottom();
10112
10116
  }
@@ -10116,7 +10120,7 @@ function SelectField({ value, onChange, options = [], placeholder, isError, sear
10116
10120
  setOptionsState(options);
10117
10121
  }, [options]);
10118
10122
  const handleChange = (data) => {
10119
- optionsCacheRef.current = data.length > 0 ? optionsState.filter(item => data.includes(item.value)) : optionsState;
10123
+ fillOptionsCache(data);
10120
10124
  if (data.length === 0 && required) {
10121
10125
  let newValue;
10122
10126
  if (Array.isArray(value)) {