@ic-reactor/react 1.7.0 → 1.7.2

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.
@@ -71,6 +71,7 @@ const DEFAULT_STATE = {
71
71
  const actorHooks = (actorManager) => {
72
72
  const { actorStore, canisterId, visitFunction, methodAttributes, updateMethodState, extractMethodAttributes, extractInterface, callMethodWithOptions, initialize, } = actorManager;
73
73
  const useActorState = () => (0, zustand_1.useStore)(actorStore, (0, shallow_1.useShallow)((state) => ({
74
+ name: state.name,
74
75
  error: state.error,
75
76
  initialized: state.initialized,
76
77
  initializing: state.initializing,
@@ -139,12 +140,16 @@ const actorHooks = (actorManager) => {
139
140
  const _b = useSharedCall(rest), { call } = _b, state = __rest(_b, ["call"]);
140
141
  const intervalId = React.useRef();
141
142
  React.useEffect(() => {
143
+ var _a;
142
144
  if (refetchInterval) {
143
145
  intervalId.current = setInterval(call, refetchInterval);
144
146
  }
145
147
  if (refetchOnMount && state.data === undefined) {
146
148
  call();
147
149
  }
150
+ else if (refetchOnMount && state.data !== undefined) {
151
+ (_a = rest.onSuccess) === null || _a === void 0 ? void 0 : _a.call(rest, state.data);
152
+ }
148
153
  return () => clearInterval(intervalId.current);
149
154
  }, [refetchInterval, refetchOnMount]);
150
155
  return Object.assign({ call }, state);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ic-reactor/react",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
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",
@@ -35,7 +35,7 @@
35
35
  "node": ">=10"
36
36
  },
37
37
  "dependencies": {
38
- "@ic-reactor/core": "^1.7.0",
38
+ "@ic-reactor/core": "^1.7.2",
39
39
  "zustand-utils": "^1.3"
40
40
  },
41
41
  "peerDependencies": {
@@ -47,5 +47,5 @@
47
47
  "react": ">=16.8",
48
48
  "zustand": "4.5"
49
49
  },
50
- "gitHead": "0fac1036d11ae1b2498e6568d5eff514bd657116"
50
+ "gitHead": "9b338aa4b97dc0fb2476c57253f4e274effc0cfe"
51
51
  }