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 CHANGED
@@ -710,20 +710,20 @@ function useApiActionState(actionConfig, cacheKey, execute, input, enabled) {
710
710
  getClientSnapshot,
711
711
  getServerSnapshot
712
712
  );
713
- const refetch = (0, import_react4.useCallback)(() => {
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
- refetchRef.current = refetch;
719
- }, [refetch]);
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
- refetchRef.current();
722
+ refetch();
723
723
  } else if (enabled && state.isStale && !state.loading) {
724
- refetchRef.current();
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 refetch = useCallback3(() => {
675
- execute(input);
676
- }, [execute, JSON.stringify(input)]);
677
- const refetchRef = useRef4(refetch);
674
+ const inputRef = useRef4(input);
678
675
  useEffect4(() => {
679
- refetchRef.current = refetch;
680
- }, [refetch]);
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
- refetchRef.current();
683
+ refetch();
684
684
  } else if (enabled && state.isStale && !state.loading) {
685
- refetchRef.current();
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() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "api-core-lib",
3
- "version": "12.0.18",
3
+ "version": "12.0.19",
4
4
  "description": "A flexible and powerful API client library for modern web applications.",
5
5
  "type": "module",
6
6