react-simplikit 0.0.14 → 0.0.15
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.
|
@@ -131,9 +131,10 @@ function throttle(func, throttleMs, { edges = ["leading", "trailing"] } = {}) {
|
|
|
131
131
|
function useThrottle(callback, wait, options) {
|
|
132
132
|
const preservedCallback = usePreservedCallback(callback);
|
|
133
133
|
const preservedOptions = usePreservedReference(options ?? {});
|
|
134
|
-
const throttledCallback = (0, import_react3.useMemo)(
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
const throttledCallback = (0, import_react3.useMemo)(
|
|
135
|
+
() => throttle(preservedCallback, wait, preservedOptions),
|
|
136
|
+
[preservedOptions, preservedCallback, wait]
|
|
137
|
+
);
|
|
137
138
|
(0, import_react3.useEffect)(() => {
|
|
138
139
|
return () => {
|
|
139
140
|
throttledCallback.cancel();
|
package/dist/index.cjs
CHANGED
|
@@ -696,9 +696,10 @@ function throttle(func, throttleMs, { edges = ["leading", "trailing"] } = {}) {
|
|
|
696
696
|
function useThrottle(callback, wait, options) {
|
|
697
697
|
const preservedCallback = usePreservedCallback(callback);
|
|
698
698
|
const preservedOptions = usePreservedReference(options ?? {});
|
|
699
|
-
const throttledCallback = (0, import_react20.useMemo)(
|
|
700
|
-
|
|
701
|
-
|
|
699
|
+
const throttledCallback = (0, import_react20.useMemo)(
|
|
700
|
+
() => throttle(preservedCallback, wait, preservedOptions),
|
|
701
|
+
[preservedOptions, preservedCallback, wait]
|
|
702
|
+
);
|
|
702
703
|
(0, import_react20.useEffect)(() => {
|
|
703
704
|
return () => {
|
|
704
705
|
throttledCallback.cancel();
|
|
@@ -105,9 +105,10 @@ function throttle(func, throttleMs, { edges = ["leading", "trailing"] } = {}) {
|
|
|
105
105
|
function useThrottle(callback, wait, options) {
|
|
106
106
|
const preservedCallback = usePreservedCallback(callback);
|
|
107
107
|
const preservedOptions = usePreservedReference(options ?? {});
|
|
108
|
-
const throttledCallback = useMemo2(
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
const throttledCallback = useMemo2(
|
|
109
|
+
() => throttle(preservedCallback, wait, preservedOptions),
|
|
110
|
+
[preservedOptions, preservedCallback, wait]
|
|
111
|
+
);
|
|
111
112
|
useEffect2(() => {
|
|
112
113
|
return () => {
|
|
113
114
|
throttledCallback.cancel();
|
package/esm/index.js
CHANGED
|
@@ -647,9 +647,10 @@ function throttle(func, throttleMs, { edges = ["leading", "trailing"] } = {}) {
|
|
|
647
647
|
function useThrottle(callback, wait, options) {
|
|
648
648
|
const preservedCallback = usePreservedCallback(callback);
|
|
649
649
|
const preservedOptions = usePreservedReference(options ?? {});
|
|
650
|
-
const throttledCallback = useMemo6(
|
|
651
|
-
|
|
652
|
-
|
|
650
|
+
const throttledCallback = useMemo6(
|
|
651
|
+
() => throttle(preservedCallback, wait, preservedOptions),
|
|
652
|
+
[preservedOptions, preservedCallback, wait]
|
|
653
|
+
);
|
|
653
654
|
useEffect11(() => {
|
|
654
655
|
return () => {
|
|
655
656
|
throttledCallback.cancel();
|