api-core-lib 12.0.19 → 12.0.20

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
@@ -717,6 +717,18 @@ function useApiActionState(actionConfig, cacheKey, execute, input, enabled) {
717
717
  const refetch = (0, import_react4.useCallback)(() => {
718
718
  execute(inputRef.current);
719
719
  }, [execute]);
720
+ const previousInput = (0, import_react4.useRef)(JSON.stringify(input));
721
+ (0, import_react4.useEffect)(() => {
722
+ const currentInputString = JSON.stringify(input);
723
+ if (previousInput.current === currentInputString) {
724
+ return;
725
+ }
726
+ if (enabled && state.called) {
727
+ console.log("[Query Changed] Input changed, refetching...");
728
+ refetch();
729
+ }
730
+ previousInput.current = currentInputString;
731
+ }, [input, enabled, state.called, refetch]);
720
732
  (0, import_react4.useEffect)(() => {
721
733
  if (enabled && actionConfig.autoFetch && !state.called && !state.loading) {
722
734
  refetch();
@@ -774,7 +786,7 @@ function useApiModule(axiosInstance, moduleConfig, options = {}) {
774
786
  body: input,
775
787
  config: options2.config
776
788
  });
777
- console.log("[API Result]", result);
789
+ console.log("[API Result execute]", result);
778
790
  if (shouldCache) {
779
791
  globalStateManager.setState(cacheKey, (prev) => ({
780
792
  ...prev,
package/dist/client.js CHANGED
@@ -678,6 +678,18 @@ function useApiActionState(actionConfig, cacheKey, execute, input, enabled) {
678
678
  const refetch = useCallback3(() => {
679
679
  execute(inputRef.current);
680
680
  }, [execute]);
681
+ const previousInput = useRef4(JSON.stringify(input));
682
+ useEffect4(() => {
683
+ const currentInputString = JSON.stringify(input);
684
+ if (previousInput.current === currentInputString) {
685
+ return;
686
+ }
687
+ if (enabled && state.called) {
688
+ console.log("[Query Changed] Input changed, refetching...");
689
+ refetch();
690
+ }
691
+ previousInput.current = currentInputString;
692
+ }, [input, enabled, state.called, refetch]);
681
693
  useEffect4(() => {
682
694
  if (enabled && actionConfig.autoFetch && !state.called && !state.loading) {
683
695
  refetch();
@@ -735,7 +747,7 @@ function useApiModule(axiosInstance, moduleConfig, options = {}) {
735
747
  body: input,
736
748
  config: options2.config
737
749
  });
738
- console.log("[API Result]", result);
750
+ console.log("[API Result execute]", result);
739
751
  if (shouldCache) {
740
752
  globalStateManager.setState(cacheKey, (prev) => ({
741
753
  ...prev,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "api-core-lib",
3
- "version": "12.0.19",
3
+ "version": "12.0.20",
4
4
  "description": "A flexible and powerful API client library for modern web applications.",
5
5
  "type": "module",
6
6