@ic-reactor/react 1.14.4 → 1.14.6

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.
@@ -1,9 +1,9 @@
1
- import type { BaseActor, FunctionName, UseQueryCallParameters, UseSharedCallReturnType } from "../../../types";
1
+ import type { BaseActor, FunctionName, UseQueryCallParameters, UseQueryCallReturnType } from "../../../types";
2
2
  /**
3
3
  * Hook for making query calls to actors. It supports automatic refetching on component mount and at specified intervals.
4
4
  *
5
5
  * @param args {@link UseQueryCallParameters}.
6
- * @returns object {@link UseSharedCallReturnType}.
6
+ * @returns object {@link UseQueryCallReturnType}.
7
7
  * @example
8
8
  * ```tsx
9
9
  * function QueryCallComponent() {
@@ -25,4 +25,4 @@ import type { BaseActor, FunctionName, UseQueryCallParameters, UseSharedCallRetu
25
25
  * }
26
26
  * ```
27
27
  */
28
- export declare function useQueryCall<A = BaseActor, M extends FunctionName<A> = FunctionName<A>>(args: UseQueryCallParameters<A, M>): UseSharedCallReturnType<A, M>;
28
+ export declare function useQueryCall<A = BaseActor, M extends FunctionName<A> = FunctionName<A>>(args: UseQueryCallParameters<A, M>): UseQueryCallReturnType<A, M>;
@@ -6,7 +6,7 @@ const __1 = require("..");
6
6
  * Hook for making query calls to actors. It supports automatic refetching on component mount and at specified intervals.
7
7
  *
8
8
  * @param args {@link UseQueryCallParameters}.
9
- * @returns object {@link UseSharedCallReturnType}.
9
+ * @returns object {@link UseQueryCallReturnType}.
10
10
  * @example
11
11
  * ```tsx
12
12
  * function QueryCallComponent() {
@@ -1,9 +1,9 @@
1
- import type { BaseActor, FunctionName, UseUpdateCallParameters, UseSharedCallReturnType } from "../../../types";
1
+ import type { BaseActor, FunctionName, UseUpdateCallParameters, UseUpdateCallReturnType } from "../../../types";
2
2
  /**
3
3
  * Hook for making update calls to actors, handling loading states, and managing errors. It supports custom event handlers for loading, success, and error events.
4
4
  *
5
5
  * @param args {@link UseUpdateCallParameters}.
6
- * @returns object {@link UseSharedCallReturnType}.
6
+ * @returns object {@link UseUpdateCallReturnType}.
7
7
  * @example
8
8
  * ```tsx
9
9
  * function UpdateCallComponent() {
@@ -26,4 +26,4 @@ import type { BaseActor, FunctionName, UseUpdateCallParameters, UseSharedCallRet
26
26
  * }
27
27
  * ```
28
28
  */
29
- export declare function useUpdateCall<A = BaseActor, M extends FunctionName<A> = FunctionName<A>>(args: UseUpdateCallParameters<A, M>): UseSharedCallReturnType<A, M>;
29
+ export declare function useUpdateCall<A = BaseActor, M extends FunctionName<A> = FunctionName<A>>(args: UseUpdateCallParameters<A, M>): UseUpdateCallReturnType<A, M>;
@@ -6,7 +6,7 @@ const __1 = require("..");
6
6
  * Hook for making update calls to actors, handling loading states, and managing errors. It supports custom event handlers for loading, success, and error events.
7
7
  *
8
8
  * @param args {@link UseUpdateCallParameters}.
9
- * @returns object {@link UseSharedCallReturnType}.
9
+ * @returns object {@link UseUpdateCallReturnType}.
10
10
  * @example
11
11
  * ```tsx
12
12
  * function UpdateCallComponent() {
@@ -184,9 +184,7 @@ const actorHooks = (actorManager) => {
184
184
  if (refetchInterval) {
185
185
  intervalId.current = setInterval(call, refetchInterval);
186
186
  }
187
- if (refetchOnMount &&
188
- state.data === undefined &&
189
- rest.args !== undefined) {
187
+ if (refetchOnMount && state.data === undefined) {
190
188
  call();
191
189
  }
192
190
  else if (refetchOnMount && state.data !== undefined) {
@@ -68,10 +68,15 @@ export interface UseQueryCallParameters<A, M extends FunctionName<A>> extends Us
68
68
  refetchOnMount?: boolean;
69
69
  refetchInterval?: number | false;
70
70
  }
71
- export type UseQueryCall<A> = <M extends FunctionName<A>>(params: UseQueryCallParameters<A, M>) => UseSharedCallReturnType<A, M>;
71
+ export interface UseQueryCallReturnType<A, M extends FunctionName<A>> extends UseSharedCallReturnType<A, M> {
72
+ refetch: () => void;
73
+ }
74
+ export type UseQueryCall<A> = <M extends FunctionName<A>>(params: UseQueryCallParameters<A, M>) => UseQueryCallReturnType<A, M>;
72
75
  export interface UseUpdateCallParameters<A, M extends FunctionName<A>> extends UseSharedCallParameters<A, M> {
73
76
  }
74
- export type UseUpdateCall<A> = <M extends FunctionName<A>>(params: UseUpdateCallParameters<A, M>) => UseSharedCallReturnType<A, M>;
77
+ export interface UseUpdateCallReturnType<A, M extends FunctionName<A>> extends UseSharedCallReturnType<A, M> {
78
+ }
79
+ export type UseUpdateCall<A> = <M extends FunctionName<A>>(params: UseUpdateCallParameters<A, M>) => UseUpdateCallReturnType<A, M>;
75
80
  export interface DynamicDataArgs<V = unknown> {
76
81
  label: string;
77
82
  value: V;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ic-reactor/react",
3
- "version": "1.14.4",
3
+ "version": "1.14.6",
4
4
  "description": "A React library for interacting with Internet Computer canisters",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -48,7 +48,7 @@
48
48
  "react": ">=16.8",
49
49
  "zustand": "4.5"
50
50
  },
51
- "gitHead": "2e2fe22cf2af159584739cad5169022f6cb6d58c",
51
+ "gitHead": "4742824c505b09b97cbc178e7956c6eb82aa665b",
52
52
  "devDependencies": {
53
53
  "@dfinity/agent": ">=2.1",
54
54
  "@dfinity/auth-client": ">=2.1",