api-core-lib 12.0.18 → 12.0.19
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/client.cjs +9 -9
- package/dist/client.js +9 -9
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -710,20 +710,20 @@ function useApiActionState(actionConfig, cacheKey, execute, input, enabled) {
|
|
|
710
710
|
getClientSnapshot,
|
|
711
711
|
getServerSnapshot
|
|
712
712
|
);
|
|
713
|
-
const
|
|
714
|
-
execute(input);
|
|
715
|
-
}, [execute, JSON.stringify(input)]);
|
|
716
|
-
const refetchRef = (0, import_react4.useRef)(refetch);
|
|
713
|
+
const inputRef = (0, import_react4.useRef)(input);
|
|
717
714
|
(0, import_react4.useEffect)(() => {
|
|
718
|
-
|
|
719
|
-
}, [
|
|
715
|
+
inputRef.current = input;
|
|
716
|
+
}, [input]);
|
|
717
|
+
const refetch = (0, import_react4.useCallback)(() => {
|
|
718
|
+
execute(inputRef.current);
|
|
719
|
+
}, [execute]);
|
|
720
720
|
(0, import_react4.useEffect)(() => {
|
|
721
721
|
if (enabled && actionConfig.autoFetch && !state.called && !state.loading) {
|
|
722
|
-
|
|
722
|
+
refetch();
|
|
723
723
|
} else if (enabled && state.isStale && !state.loading) {
|
|
724
|
-
|
|
724
|
+
refetch();
|
|
725
725
|
}
|
|
726
|
-
}, [enabled, state.isStale, state.loading, state.called, actionConfig.autoFetch]);
|
|
726
|
+
}, [enabled, state.isStale, state.loading, state.called, actionConfig.autoFetch, refetch]);
|
|
727
727
|
return state;
|
|
728
728
|
}
|
|
729
729
|
function useModuleContext() {
|
package/dist/client.js
CHANGED
|
@@ -671,20 +671,20 @@ function useApiActionState(actionConfig, cacheKey, execute, input, enabled) {
|
|
|
671
671
|
getClientSnapshot,
|
|
672
672
|
getServerSnapshot
|
|
673
673
|
);
|
|
674
|
-
const
|
|
675
|
-
execute(input);
|
|
676
|
-
}, [execute, JSON.stringify(input)]);
|
|
677
|
-
const refetchRef = useRef4(refetch);
|
|
674
|
+
const inputRef = useRef4(input);
|
|
678
675
|
useEffect4(() => {
|
|
679
|
-
|
|
680
|
-
}, [
|
|
676
|
+
inputRef.current = input;
|
|
677
|
+
}, [input]);
|
|
678
|
+
const refetch = useCallback3(() => {
|
|
679
|
+
execute(inputRef.current);
|
|
680
|
+
}, [execute]);
|
|
681
681
|
useEffect4(() => {
|
|
682
682
|
if (enabled && actionConfig.autoFetch && !state.called && !state.loading) {
|
|
683
|
-
|
|
683
|
+
refetch();
|
|
684
684
|
} else if (enabled && state.isStale && !state.loading) {
|
|
685
|
-
|
|
685
|
+
refetch();
|
|
686
686
|
}
|
|
687
|
-
}, [enabled, state.isStale, state.loading, state.called, actionConfig.autoFetch]);
|
|
687
|
+
}, [enabled, state.isStale, state.loading, state.called, actionConfig.autoFetch, refetch]);
|
|
688
688
|
return state;
|
|
689
689
|
}
|
|
690
690
|
function useModuleContext() {
|