indicator-ui 0.0.337 → 0.0.339
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 +12 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -41558,23 +41558,28 @@ function useDebouncedInvoker(callback) {
|
|
|
41558
41558
|
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
|
|
41559
41559
|
var callbackRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(callback);
|
|
41560
41560
|
callbackRef.current = callback;
|
|
41561
|
-
var debouncedRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(
|
|
41561
|
+
var debouncedRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
|
|
41562
|
+
// Инициализация и обновление debounce
|
|
41562
41563
|
(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
|
|
41563
41564
|
debouncedRef.current = lodash_debounce__WEBPACK_IMPORTED_MODULE_0___default()(function () {
|
|
41564
|
-
|
|
41565
|
+
// Добавляем проверку перед вызовом
|
|
41566
|
+
if (typeof callbackRef.current === "function") {
|
|
41567
|
+
return callbackRef.current.apply(callbackRef, arguments);
|
|
41568
|
+
}
|
|
41565
41569
|
}, delay);
|
|
41566
41570
|
return function () {
|
|
41567
41571
|
var _debouncedRef$current;
|
|
41568
41572
|
(_debouncedRef$current = debouncedRef.current) === null || _debouncedRef$current === void 0 || _debouncedRef$current.cancel();
|
|
41573
|
+
debouncedRef.current = null;
|
|
41569
41574
|
};
|
|
41570
41575
|
}, [delay]);
|
|
41571
|
-
// Возвращаем вызываемую функцию
|
|
41572
41576
|
return (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function () {
|
|
41573
|
-
|
|
41574
|
-
|
|
41575
|
-
|
|
41577
|
+
if (debouncedRef.current) {
|
|
41578
|
+
return debouncedRef.current.apply(debouncedRef, arguments);
|
|
41579
|
+
}
|
|
41580
|
+
if (typeof callbackRef.current === "function") {
|
|
41581
|
+
return callbackRef.current.apply(callbackRef, arguments);
|
|
41576
41582
|
}
|
|
41577
|
-
return (_debouncedRef$current2 = debouncedRef.current) === null || _debouncedRef$current2 === void 0 ? void 0 : _debouncedRef$current2.call.apply(_debouncedRef$current2, [debouncedRef].concat(args));
|
|
41578
41583
|
}, []);
|
|
41579
41584
|
}
|
|
41580
41585
|
|