@ic-reactor/react 3.12.5 → 3.13.0
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/README.md +410 -44
- package/dist/auth/auth-client-compat.d.ts +122 -0
- package/dist/auth/auth-client-compat.d.ts.map +1 -0
- package/dist/auth/auth-client-compat.js +162 -0
- package/dist/auth/auth-client-compat.js.map +1 -0
- package/dist/auth/authentication-manager.d.ts +287 -5
- package/dist/auth/authentication-manager.d.ts.map +1 -1
- package/dist/auth/authentication-manager.js +920 -150
- package/dist/auth/authentication-manager.js.map +1 -1
- package/dist/auth/createIdentityAttributeHooks.d.ts.map +1 -1
- package/dist/auth/createIdentityAttributeHooks.js +36 -20
- package/dist/auth/createIdentityAttributeHooks.js.map +1 -1
- package/dist/auth/identity-attributes-manager.d.ts +2 -1
- package/dist/auth/identity-attributes-manager.d.ts.map +1 -1
- package/dist/auth/identity-attributes-manager.js +90 -6
- package/dist/auth/identity-attributes-manager.js.map +1 -1
- package/dist/auth/identity-attributes.d.ts.map +1 -1
- package/dist/auth/identity-attributes.js +57 -0
- package/dist/auth/identity-attributes.js.map +1 -1
- package/dist/auth/local-ii-probe.d.ts +12 -1
- package/dist/auth/local-ii-probe.d.ts.map +1 -1
- package/dist/auth/local-ii-probe.js +22 -3
- package/dist/auth/local-ii-probe.js.map +1 -1
- package/dist/auth/types.d.ts +48 -5
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/createActorHooks.d.ts +7 -18
- package/dist/createActorHooks.d.ts.map +1 -1
- package/dist/createActorHooks.js.map +1 -1
- package/dist/createInfiniteQuery.d.ts +51 -10
- package/dist/createInfiniteQuery.d.ts.map +1 -1
- package/dist/createInfiniteQuery.js +39 -15
- package/dist/createInfiniteQuery.js.map +1 -1
- package/dist/createMutation.d.ts +3 -0
- package/dist/createMutation.d.ts.map +1 -1
- package/dist/createMutation.js +87 -80
- package/dist/createMutation.js.map +1 -1
- package/dist/createQuery.d.ts +35 -2
- package/dist/createQuery.d.ts.map +1 -1
- package/dist/createQuery.js +104 -17
- package/dist/createQuery.js.map +1 -1
- package/dist/createReactorProvider.d.ts +158 -0
- package/dist/createReactorProvider.d.ts.map +1 -0
- package/dist/createReactorProvider.js +256 -0
- package/dist/createReactorProvider.js.map +1 -0
- package/dist/createSuspenseInfiniteQuery.d.ts +16 -9
- package/dist/createSuspenseInfiniteQuery.d.ts.map +1 -1
- package/dist/createSuspenseInfiniteQuery.js +59 -27
- package/dist/createSuspenseInfiniteQuery.js.map +1 -1
- package/dist/createSuspenseQuery.d.ts +23 -2
- package/dist/createSuspenseQuery.d.ts.map +1 -1
- package/dist/createSuspenseQuery.js +68 -21
- package/dist/createSuspenseQuery.js.map +1 -1
- package/dist/defineDisplayReactor.d.ts +43 -0
- package/dist/defineDisplayReactor.d.ts.map +1 -0
- package/dist/defineDisplayReactor.js +42 -0
- package/dist/defineDisplayReactor.js.map +1 -0
- package/dist/defineReactor.d.ts +46 -72
- package/dist/defineReactor.d.ts.map +1 -1
- package/dist/defineReactor.js +11 -176
- package/dist/defineReactor.js.map +1 -1
- package/dist/defineReactorShared.d.ts +84 -0
- package/dist/defineReactorShared.d.ts.map +1 -0
- package/dist/defineReactorShared.js +139 -0
- package/dist/defineReactorShared.js.map +1 -0
- package/dist/hooks/createAuthHooks.d.ts +7 -0
- package/dist/hooks/createAuthHooks.d.ts.map +1 -1
- package/dist/hooks/createAuthHooks.js +180 -20
- package/dist/hooks/createAuthHooks.js.map +1 -1
- package/dist/hooks/useActorInfiniteQuery.d.ts +34 -6
- package/dist/hooks/useActorInfiniteQuery.d.ts.map +1 -1
- package/dist/hooks/useActorInfiniteQuery.js +54 -21
- package/dist/hooks/useActorInfiniteQuery.js.map +1 -1
- package/dist/hooks/useActorMethod.d.ts +37 -4
- package/dist/hooks/useActorMethod.d.ts.map +1 -1
- package/dist/hooks/useActorMethod.js +201 -57
- package/dist/hooks/useActorMethod.js.map +1 -1
- package/dist/hooks/useActorMutation.d.ts +10 -7
- package/dist/hooks/useActorMutation.d.ts.map +1 -1
- package/dist/hooks/useActorMutation.js +14 -13
- package/dist/hooks/useActorMutation.js.map +1 -1
- package/dist/hooks/useActorQuery.d.ts +17 -4
- package/dist/hooks/useActorQuery.d.ts.map +1 -1
- package/dist/hooks/useActorQuery.js +30 -9
- package/dist/hooks/useActorQuery.js.map +1 -1
- package/dist/hooks/useActorSuspenseInfiniteQuery.d.ts +15 -3
- package/dist/hooks/useActorSuspenseInfiniteQuery.d.ts.map +1 -1
- package/dist/hooks/useActorSuspenseInfiniteQuery.js +37 -17
- package/dist/hooks/useActorSuspenseInfiniteQuery.js.map +1 -1
- package/dist/hooks/useActorSuspenseQuery.d.ts +2 -2
- package/dist/hooks/useActorSuspenseQuery.d.ts.map +1 -1
- package/dist/hooks/useActorSuspenseQuery.js +20 -9
- package/dist/hooks/useActorSuspenseQuery.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/ownedAuthentication.d.ts +52 -0
- package/dist/ownedAuthentication.d.ts.map +1 -0
- package/dist/ownedAuthentication.js +49 -0
- package/dist/ownedAuthentication.js.map +1 -0
- package/dist/server.d.ts +21 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +23 -0
- package/dist/server.js.map +1 -0
- package/dist/testing.d.ts +19 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +19 -0
- package/dist/testing.js.map +1 -0
- package/dist/types.d.ts +416 -15
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/utils.d.ts +159 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +301 -1
- package/dist/utils.js.map +1 -1
- package/dist/validation.d.ts +12 -7
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +34 -15
- package/dist/validation.js.map +1 -1
- package/llms.txt +259 -33
- package/package.json +17 -5
- package/src/auth/auth-client-compat.ts +273 -0
- package/src/auth/authentication-manager.ts +918 -96
- package/src/auth/createIdentityAttributeHooks.ts +47 -21
- package/src/auth/identity-attributes-manager.ts +100 -5
- package/src/auth/identity-attributes.ts +75 -0
- package/src/auth/local-ii-probe.ts +29 -3
- package/src/auth/types.ts +49 -6
- package/src/createActorHooks.ts +20 -32
- package/src/createInfiniteQuery.ts +120 -28
- package/src/createMutation.ts +161 -178
- package/src/createQuery.ts +164 -32
- package/src/createReactorProvider.ts +365 -0
- package/src/createSuspenseInfiniteQuery.ts +93 -43
- package/src/createSuspenseQuery.ts +102 -32
- package/src/defineDisplayReactor.ts +62 -0
- package/src/defineReactor.ts +81 -263
- package/src/defineReactorShared.ts +268 -0
- package/src/hooks/createAuthHooks.ts +206 -24
- package/src/hooks/useActorInfiniteQuery.ts +122 -49
- package/src/hooks/useActorMethod.ts +295 -92
- package/src/hooks/useActorMutation.ts +23 -23
- package/src/hooks/useActorQuery.ts +43 -10
- package/src/hooks/useActorSuspenseInfiniteQuery.ts +93 -50
- package/src/hooks/useActorSuspenseQuery.ts +30 -15
- package/src/index.ts +8 -0
- package/src/ownedAuthentication.ts +81 -0
- package/src/server.ts +23 -0
- package/src/testing.ts +18 -0
- package/src/types.ts +463 -14
- package/src/utils.ts +387 -3
- package/src/validation.ts +43 -19
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
import { useSyncExternalStore, useEffect, useRef, useMemo } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The managers whose session a `useAuth()` has already started restoring.
|
|
4
|
+
*
|
|
5
|
+
* Restoring ends in `authenticate()`, which publishes `isAuthenticating: true`
|
|
6
|
+
* and then the restored state. It used to run once per mounted `useAuth()`
|
|
7
|
+
* rather than once per manager, so every consumer that mounted while signed out
|
|
8
|
+
* flipped `isAuthenticating` for the whole app, and one that mounted while a
|
|
9
|
+
* sign-in popup was open cleared `isAuthenticating` before the sign-in ended. A
|
|
10
|
+
* component that hides a `useAuth()` consumer while `isAuthenticating` never
|
|
11
|
+
* settled: each restore unmounted the consumer, and each remount restored
|
|
12
|
+
* again. Both clients answer from memory once loaded, so that loop ran on the
|
|
13
|
+
* microtask queue and the page never painted again.
|
|
14
|
+
*
|
|
15
|
+
* Keyed by manager rather than by `createAuthHooks` call, because reactors that
|
|
16
|
+
* share one `AuthenticationManager` each build their own hooks.
|
|
17
|
+
*/
|
|
18
|
+
const restoredSessions = new WeakSet();
|
|
19
|
+
/**
|
|
20
|
+
* How many `useAuth()` consumers of each manager are mounted, so that a
|
|
21
|
+
* restore can tell a manager that was discarded from one StrictMode released
|
|
22
|
+
* and mounted again; see `useAuth()`.
|
|
23
|
+
*/
|
|
24
|
+
const mountedConsumers = new WeakMap();
|
|
2
25
|
/**
|
|
3
26
|
* The principal both hooks return.
|
|
4
27
|
*
|
|
@@ -12,6 +35,30 @@ import { useSyncExternalStore, useEffect, useRef, useMemo } from "react";
|
|
|
12
35
|
function usePrincipal(isAuthenticated, identity) {
|
|
13
36
|
return useMemo(() => (isAuthenticated && identity ? identity.getPrincipal() : null), [isAuthenticated, identity]);
|
|
14
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* The auth state a server render shows, and so the one hydration shows.
|
|
40
|
+
*
|
|
41
|
+
* `useSyncExternalStore` renders `getServerSnapshot` on the server and again
|
|
42
|
+
* while hydrating, and both renders have to produce the HTML the server sent.
|
|
43
|
+
* The hooks passed the live state for both. A server holds no session, so its
|
|
44
|
+
* HTML is signed out. A component that hydrates after the session is restored,
|
|
45
|
+
* such as one inside a Suspense boundary whose code arrives later, read the
|
|
46
|
+
* restored state and no longer matched that HTML. React then reported a
|
|
47
|
+
* hydration error and threw the boundary's server HTML away to render it again
|
|
48
|
+
* on the client. A constant also keeps a server render from showing whatever a
|
|
49
|
+
* manager shared across requests happens to hold.
|
|
50
|
+
*
|
|
51
|
+
* It is the state the hooks report before the session has been checked: a
|
|
52
|
+
* server cannot know the session, so it renders the "checking" state that a
|
|
53
|
+
* browser shows until its restore settles. Once hydrated, React compares it
|
|
54
|
+
* with the live state and renders again with that.
|
|
55
|
+
*/
|
|
56
|
+
const SERVER_AUTH_STATE = Object.freeze({
|
|
57
|
+
identity: null,
|
|
58
|
+
isAuthenticating: true,
|
|
59
|
+
isAuthenticated: false,
|
|
60
|
+
error: undefined,
|
|
61
|
+
});
|
|
15
62
|
/**
|
|
16
63
|
* Create authentication hooks for managing user sessions with Internet Identity.
|
|
17
64
|
*
|
|
@@ -41,24 +88,77 @@ export const createAuthHooks = (authentication) => {
|
|
|
41
88
|
"`defineReactor(...).authentication`.");
|
|
42
89
|
}
|
|
43
90
|
const { clientManager } = authentication;
|
|
91
|
+
// The agent state a manager starts in, for the reason given at
|
|
92
|
+
// SERVER_AUTH_STATE: `useAuth()` initializes the agent once hydrated, so a
|
|
93
|
+
// component hydrating later read `isInitialized: true` against server HTML
|
|
94
|
+
// rendered before any initialization. The network is kept: it comes from the
|
|
95
|
+
// agent's host, which initialization does not change.
|
|
96
|
+
const serverAgentState = Object.freeze({
|
|
97
|
+
isInitialized: false,
|
|
98
|
+
isInitializing: false,
|
|
99
|
+
error: undefined,
|
|
100
|
+
network: clientManager.network,
|
|
101
|
+
isLocalhost: clientManager.isLocal,
|
|
102
|
+
});
|
|
103
|
+
// What every consumer hands `useSyncExternalStore`, built once rather than
|
|
104
|
+
// on each render. React unsubscribes and subscribes again whenever the
|
|
105
|
+
// subscribe function changes, and each unsubscribe filters the manager's
|
|
106
|
+
// whole subscriber list. An auth state change re-renders every consumer, so
|
|
107
|
+
// a function per render cost k re-subscriptions and about k²/2 subscriber
|
|
108
|
+
// visits for k consumers: two million for 2,000 `useUserPrincipal()` rows.
|
|
109
|
+
const subscribeAgentState = (callback) => clientManager.subscribeAgentState(callback);
|
|
110
|
+
const getAgentState = () => clientManager.agentState;
|
|
111
|
+
const getServerAgentState = () => serverAgentState;
|
|
112
|
+
// Until the session has been checked, `authState` is the signed-out state
|
|
113
|
+
// the manager starts in, and reporting it as the answer sent signed-in users
|
|
114
|
+
// to the login page (#621). `useAuth()` starts the check from an effect, so
|
|
115
|
+
// on the first render nothing had been checked, yet `isAuthenticating` was
|
|
116
|
+
// false: a guard that redirects when `!isAuthenticating && !isAuthenticated`
|
|
117
|
+
// redirected before the session was ever read. The hooks report
|
|
118
|
+
// `isAuthenticating: true` until the check settles instead. The snapshot is
|
|
119
|
+
// kept per source state, because `useSyncExternalStore` needs the same object
|
|
120
|
+
// back until something changes.
|
|
121
|
+
let unchecked;
|
|
122
|
+
const subscribeAuthState = (callback) => {
|
|
123
|
+
const unsubscribeState = authentication.subscribeAuthState(callback);
|
|
124
|
+
const unsubscribeChecked = authentication.subscribeSessionChecked(callback);
|
|
125
|
+
return () => {
|
|
126
|
+
unsubscribeState();
|
|
127
|
+
unsubscribeChecked();
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
const getAuthState = () => {
|
|
131
|
+
const state = authentication.authState;
|
|
132
|
+
if (authentication.sessionChecked || state.isAuthenticating)
|
|
133
|
+
return state;
|
|
134
|
+
if (unchecked?.source !== state) {
|
|
135
|
+
unchecked = {
|
|
136
|
+
source: state,
|
|
137
|
+
state: Object.freeze({ ...state, isAuthenticating: true }),
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
return unchecked.state;
|
|
141
|
+
};
|
|
142
|
+
const getServerAuthState = () => SERVER_AUTH_STATE;
|
|
44
143
|
/**
|
|
45
144
|
* Subscribe to agent state changes.
|
|
46
145
|
* Returns the current agent state (agent, isInitialized, etc.)
|
|
47
146
|
*/
|
|
48
|
-
const useAgentState = () => useSyncExternalStore(
|
|
49
|
-
// Server snapshot - provide initial state for SSR
|
|
50
|
-
() => clientManager.agentState);
|
|
147
|
+
const useAgentState = () => useSyncExternalStore(subscribeAgentState, getAgentState, getServerAgentState);
|
|
51
148
|
/**
|
|
52
149
|
* Subscribe to authentication state changes.
|
|
53
150
|
* Returns auth state (isAuthenticated, isAuthenticating, identity, error)
|
|
54
151
|
*/
|
|
55
|
-
const useAuthState = () => useSyncExternalStore(
|
|
56
|
-
// Server snapshot - provide initial state for SSR
|
|
57
|
-
() => authentication.authState);
|
|
152
|
+
const useAuthState = () => useSyncExternalStore(subscribeAuthState, getAuthState, getServerAuthState);
|
|
58
153
|
/**
|
|
59
154
|
* Main authentication hook that provides login/logout methods and auth state.
|
|
60
155
|
* Automatically initializes the session on first use, restoring any previous session.
|
|
61
156
|
*
|
|
157
|
+
* `isAuthenticating` is `true` until that restore has settled, including on
|
|
158
|
+
* the first render and in a server render, so a guard that shows a spinner
|
|
159
|
+
* while `isAuthenticating` never takes the state before the restore for a
|
|
160
|
+
* signed-out user. A restore that fails settles it too.
|
|
161
|
+
*
|
|
62
162
|
* @example
|
|
63
163
|
* function AuthButton() {
|
|
64
164
|
* const { login, logout, isAuthenticated, isAuthenticating } = useAuth()
|
|
@@ -76,23 +176,83 @@ export const createAuthHooks = (authentication) => {
|
|
|
76
176
|
const useAuth = () => {
|
|
77
177
|
const { login, logout, authenticate } = authentication;
|
|
78
178
|
const { isAuthenticated, isAuthenticating, identity, error } = useAuthState();
|
|
79
|
-
//
|
|
179
|
+
// Keeps a StrictMode re-run of the effect below from repeating it.
|
|
80
180
|
const initializedRef = useRef(false);
|
|
81
|
-
//
|
|
82
|
-
// `prepareClient` also warms up the AuthClient so a later
|
|
83
|
-
// open the identity provider window inside the click handler.
|
|
181
|
+
// Restore the previous session when the first consumer of this manager
|
|
182
|
+
// mounts. `prepareClient` also warms up the AuthClient so a later
|
|
183
|
+
// `login()` can open the identity provider window inside the click handler.
|
|
84
184
|
useEffect(() => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
authentication
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
185
|
+
mountedConsumers.set(authentication, (mountedConsumers.get(authentication) ?? 0) + 1);
|
|
186
|
+
const unmount = () => {
|
|
187
|
+
mountedConsumers.set(authentication, (mountedConsumers.get(authentication) ?? 1) - 1);
|
|
188
|
+
};
|
|
189
|
+
if (initializedRef.current && restoredSessions.has(authentication)) {
|
|
190
|
+
return unmount;
|
|
191
|
+
}
|
|
192
|
+
const firstRun = !initializedRef.current;
|
|
193
|
+
initializedRef.current = true;
|
|
194
|
+
if (restoredSessions.has(authentication)) {
|
|
195
|
+
// Restored already. A live session is still checked again, which
|
|
196
|
+
// notices a delegation that has lapsed since and publishes nothing
|
|
197
|
+
// while it is valid.
|
|
198
|
+
if (firstRun && authentication.authState.isAuthenticated) {
|
|
199
|
+
authentication.authenticate().catch(() => undefined);
|
|
200
|
+
}
|
|
201
|
+
return unmount;
|
|
95
202
|
}
|
|
203
|
+
restoredSessions.add(authentication);
|
|
204
|
+
// A provider that builds its managers per mount disposes the manager
|
|
205
|
+
// from its cleanup. One that unmounted before this restore had built
|
|
206
|
+
// the client still got one, built after `dispose()` and never released,
|
|
207
|
+
// so each quick remount left a live client listening to the page. The
|
|
208
|
+
// restore stops instead once the manager has been disposed since it
|
|
209
|
+
// began and no `useAuth()` of it is mounted, releasing what it built.
|
|
210
|
+
// StrictMode's cleanup disposes the manager too, but mounts this
|
|
211
|
+
// consumer again before the restore looks, and that restore goes on.
|
|
212
|
+
// One that stopped counts as not having run, so a manager mounted again,
|
|
213
|
+
// as `<Activity>` mounts a tree it showed again, restores.
|
|
214
|
+
const releases = authentication.releaseCount;
|
|
215
|
+
const abandoned = () => {
|
|
216
|
+
if (authentication.releaseCount === releases ||
|
|
217
|
+
(mountedConsumers.get(authentication) ?? 0) > 0) {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
authentication.dispose();
|
|
221
|
+
restoredSessions.delete(authentication);
|
|
222
|
+
return true;
|
|
223
|
+
};
|
|
224
|
+
void authentication
|
|
225
|
+
.prepareClient()
|
|
226
|
+
.catch(() => undefined)
|
|
227
|
+
.then(async () => {
|
|
228
|
+
if (abandoned())
|
|
229
|
+
return false;
|
|
230
|
+
await clientManager.initialize();
|
|
231
|
+
if (abandoned())
|
|
232
|
+
return false;
|
|
233
|
+
// A check that has settled already and found no session, such as
|
|
234
|
+
// the one a manager runs over a client handed to its constructor,
|
|
235
|
+
// or a route loader's `authenticate()`, answered what this restore
|
|
236
|
+
// would. Running it again only flashed `isAuthenticating`, and a
|
|
237
|
+
// guard redirected a second time. A live session is still checked,
|
|
238
|
+
// which publishes nothing while it is valid.
|
|
239
|
+
const { isAuthenticated, error } = authentication.authState;
|
|
240
|
+
if (authentication.sessionChecked && !isAuthenticated && !error) {
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
await authentication.authenticate().catch(() => undefined);
|
|
244
|
+
return !abandoned();
|
|
245
|
+
})
|
|
246
|
+
// Failures are already reflected in authState/agentState; without
|
|
247
|
+
// this the rejection escapes as an unhandled promise rejection. A
|
|
248
|
+
// restore that failed before it reached `authenticate()`, such as a
|
|
249
|
+
// root key that could not be fetched, has settled all the same.
|
|
250
|
+
.catch(() => true)
|
|
251
|
+
.then((settled) => {
|
|
252
|
+
if (settled)
|
|
253
|
+
authentication.markSessionChecked();
|
|
254
|
+
});
|
|
255
|
+
return unmount;
|
|
96
256
|
}, []);
|
|
97
257
|
const principal = usePrincipal(isAuthenticated, identity);
|
|
98
258
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAuthHooks.js","sourceRoot":"","sources":["../../src/hooks/createAuthHooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"createAuthHooks.js","sourceRoot":"","sources":["../../src/hooks/createAuthHooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAoCxE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAAyB,CAAA;AAE7D;;;;GAIG;AACH,MAAM,gBAAg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KAAK,EAAE,GAAG,cAAc,CAAC,SAAS,CAAA;gBAC3D,IAAI,cAAc,CAAC,cAAc,IAAI,CAAC,eAAe,IAAI,CAAC,KAAK,EAAE,CAAC;oBAChE,OAAO,IAAI,CAAA;gBACb,CAAC;gBACD,MAAM,cAAc,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;gBAC1D,OAAO,CAAC,SAAS,EAAE,CAAA;YACrB,CAAC,CAAC;gBACF,kEAAkE;gBAClE,kEAAkE;gBAClE,oEAAoE;gBACpE,gEAAgE;iBAC/D,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;iBACjB,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;gBAChB,IAAI,OAAO;oBAAE,cAAc,CAAC,kBAAkB,EAAE,CAAA;YAClD,CAAC,CAAC,CAAA;YAEJ,OAAO,OAAO,CAAA;QAChB,CAAC,EAAE,EAAE,CAAC,CAAA;QAEN,MAAM,SAAS,GAAG,YAAY,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAA;QAEzD,OAAO;YACL,YAAY;YACZ,KAAK;YACL,MAAM;YACN,eAAe;YACf,gBAAgB;YAChB,SAAS;YACT,QAAQ;YACR,KAAK;SACN,CAAA;IACH,CAAC,CAAA;IAED;;;;;;;;;;;OAWG;IACH,MAAM,gBAAgB,GAAG,GAAqB,EAAE;QAC9C,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,GAAG,YAAY,EAAE,CAAA;QACpD,OAAO,YAAY,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAA;IAChD,CAAC,CAAA;IAED,OAAO;QACL,OAAO;QACP,aAAa;QACb,gBAAgB;KACjB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { QueryKey, UseInfiniteQueryResult, UseInfiniteQueryOptions, InfiniteData } from "@tanstack/react-query";
|
|
1
|
+
import { QueryKey, UseInfiniteQueryResult, UseInfiniteQueryOptions, InfiniteData, type SkipToken } from "@tanstack/react-query";
|
|
2
2
|
import { FunctionName, Reactor, TransformKey, ReactorArgs, ReactorReturnOk, ReactorQueryData, ReactorReturnErr } from "@ic-reactor/core";
|
|
3
3
|
import { CallConfig } from "@icp-sdk/core/agent";
|
|
4
4
|
/**
|
|
@@ -10,8 +10,25 @@ export interface UseActorInfiniteQueryParameters<Service, Method extends Functio
|
|
|
10
10
|
reactor: Reactor<Service, Transform>;
|
|
11
11
|
/** The method name to call on the canister */
|
|
12
12
|
functionName: Method;
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Function to get args from page parameter, or TanStack Query's `skipToken`
|
|
15
|
+
* while the args are not known: the query then waits without fetching, in
|
|
16
|
+
* an entry of its own under its method and `queryKey`, which no call's key
|
|
17
|
+
* shares, so it shows no data until the args arrive.
|
|
18
|
+
*/
|
|
19
|
+
getArgs: ((pageParam: TPageParam) => ReactorArgs<Service, Method, Transform>) | SkipToken;
|
|
20
|
+
/**
|
|
21
|
+
* Narrows what the cache key derives from the call arguments.
|
|
22
|
+
*
|
|
23
|
+
* By default the key is scoped by `getArgs(initialPageParam)`, so two
|
|
24
|
+
* infinite queries on the same method with different arguments stay in
|
|
25
|
+
* separate cache entries. Supply this when those args embed the cursor and
|
|
26
|
+
* only part of them identifies the query — return the stable, serializable
|
|
27
|
+
* portion (typically everything except the pagination field). It is required
|
|
28
|
+
* when `initialPageParam` changes between renders, as `Date.now()` does:
|
|
29
|
+
* without it every render keys a new query.
|
|
30
|
+
*/
|
|
31
|
+
getKeyArgs?: (args: ReactorArgs<Service, Method, Transform>) => unknown;
|
|
15
32
|
/** Agent call configuration (effectiveCanisterId, etc.) */
|
|
16
33
|
callConfig?: CallConfig;
|
|
17
34
|
/** Custom query key (auto-generated if not provided) */
|
|
@@ -27,13 +44,24 @@ export type UseActorInfiniteQueryResult<Service, Method extends FunctionName<Ser
|
|
|
27
44
|
* Hook for executing infinite/paginated query calls on a canister.
|
|
28
45
|
*
|
|
29
46
|
* @example
|
|
30
|
-
* const { data, fetchNextPage, hasNextPage } =
|
|
47
|
+
* const { data, fetchNextPage, hasNextPage } = useReactorInfiniteQuery({
|
|
31
48
|
* reactor,
|
|
32
49
|
* functionName: "getItems",
|
|
33
|
-
* getArgs: (pageParam) => [{ offset: pageParam, limit: 10 }],
|
|
50
|
+
* getArgs: (pageParam) => [{ offset: pageParam, limit: 10 }] as const,
|
|
51
|
+
* initialPageParam: 0,
|
|
52
|
+
* getNextPageParam: (lastPage) => lastPage.nextOffset,
|
|
53
|
+
* })
|
|
54
|
+
*
|
|
55
|
+
* // Wait for the args: no fetch until userId is known
|
|
56
|
+
* const { data } = useReactorInfiniteQuery({
|
|
57
|
+
* reactor,
|
|
58
|
+
* functionName: "getUserItems",
|
|
59
|
+
* getArgs: userId
|
|
60
|
+
* ? (pageParam) => [{ userId, offset: pageParam, limit: 10 }] as const
|
|
61
|
+
* : skipToken,
|
|
34
62
|
* initialPageParam: 0,
|
|
35
63
|
* getNextPageParam: (lastPage) => lastPage.nextOffset,
|
|
36
64
|
* })
|
|
37
65
|
*/
|
|
38
|
-
export declare const useActorInfiniteQuery: <Service, Method extends FunctionName<Service>, Transform extends TransformKey = "candid", TPageParam = unknown, Selected = InfiniteData<ReactorQueryData<ReactorReturnOk<Service, Method, Transform>>, TPageParam>>({ reactor, functionName, getArgs, callConfig, queryKey, ...options }: UseActorInfiniteQueryParameters<Service, Method, Transform, TPageParam, Selected>) => UseActorInfiniteQueryResult<Service, Method, Transform, TPageParam, Selected>;
|
|
66
|
+
export declare const useActorInfiniteQuery: <Service, Method extends FunctionName<Service>, Transform extends TransformKey = "candid", TPageParam = unknown, Selected = InfiniteData<ReactorQueryData<ReactorReturnOk<Service, Method, Transform>>, TPageParam>>({ reactor, functionName, getArgs, getKeyArgs, callConfig, queryKey, ...options }: UseActorInfiniteQueryParameters<Service, Method, Transform, TPageParam, Selected>) => UseActorInfiniteQueryResult<Service, Method, Transform, TPageParam, Selected>;
|
|
39
67
|
//# sourceMappingURL=useActorInfiniteQuery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActorInfiniteQuery.d.ts","sourceRoot":"","sources":["../../src/hooks/useActorInfiniteQuery.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"useActorInfiniteQuery.d.ts","sourceRoot":"","sources":["../../src/hooks/useActorInfiniteQuery.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAGR,sBAAsB,EACtB,uBAAuB,EACvB,YAAY,EACZ,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAUhD;;;GAGG;AACH,MAAM,WAAW,+BAA+B,CAC9C,OAAO,EACP,MAAM,SAAS,YAAY,CAAC,OAAO,CAAC,EACpC,SAAS,SAAS,YAAY,GAAG,QAAQ,EACzC,UAAU,GAAG,OAAO,EACpB,QAAQ,GAAG,YAAY,CACrB,gBAAgB,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,EAC7D,UAAU,CACX,CACD,SAAQ,IAAI,CACZ,uBAAuB,CACrB,gBAAgB,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,EAC7D,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAC5C,QAAQ,EACR,QAAQ,EACR,UAAU,CACX,EACD,UAAU,GAAG,SAAS,GAAG,kBAAkB,GAAG,kBAAkB,CACjE;IACC,mDAAmD;IACnD,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IACpC,8CAA8C;IAC9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AAY,GAAG,QAAQ,EACzC,UAAU,GAAG,OAAO,EACpB,QAAQ,GAAG,YAAY,CACrB,gBAAgB,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,EAC7D,UAAU,CACX,IACC,sBAAsB,CACxB,QAAQ,EACR,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAC7C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,qBAAqB,GAChC,OAAO,EACP,MAAM,SAAS,YAAY,CAAC,OAAO,CAAC,EACpC,SAAS,SAAS,YAAY,GAAG,QAAQ,EACzC,UAAU,GAAG,OAAO,EACpB,QAAQ,GAAG,YAAY,CACrB,gBAAgB,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,EAC7D,UAAU,CACX,EACD,kFAQC,+BAA+B,CAChC,OAAO,EACP,MAAM,EACN,SAAS,EACT,UAAU,EACV,QAAQ,CACT,KAAG,2BAA2B,CAC7B,OAAO,EACP,MAAM,EACN,SAAS,EACT,UAAU,EACV,QAAQ,CAoGT,CAAA"}
|
|
@@ -1,30 +1,56 @@
|
|
|
1
|
-
import { useMemo
|
|
2
|
-
import { useInfiniteQuery, } from "@tanstack/react-query";
|
|
3
|
-
import { mergeFactoryQueryKey, normalizeQueryData } from "../utils.js";
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useInfiniteQuery, skipToken, } from "@tanstack/react-query";
|
|
3
|
+
import { callConfigForKey, mergeFactoryQueryKey, normalizeQueryData, retryOption, skippedQueryKey, useMountQueryClient, } from "../utils.js";
|
|
4
4
|
/**
|
|
5
5
|
* Hook for executing infinite/paginated query calls on a canister.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
|
-
* const { data, fetchNextPage, hasNextPage } =
|
|
8
|
+
* const { data, fetchNextPage, hasNextPage } = useReactorInfiniteQuery({
|
|
9
9
|
* reactor,
|
|
10
10
|
* functionName: "getItems",
|
|
11
|
-
* getArgs: (pageParam) => [{ offset: pageParam, limit: 10 }],
|
|
11
|
+
* getArgs: (pageParam) => [{ offset: pageParam, limit: 10 }] as const,
|
|
12
|
+
* initialPageParam: 0,
|
|
13
|
+
* getNextPageParam: (lastPage) => lastPage.nextOffset,
|
|
14
|
+
* })
|
|
15
|
+
*
|
|
16
|
+
* // Wait for the args: no fetch until userId is known
|
|
17
|
+
* const { data } = useReactorInfiniteQuery({
|
|
18
|
+
* reactor,
|
|
19
|
+
* functionName: "getUserItems",
|
|
20
|
+
* getArgs: userId
|
|
21
|
+
* ? (pageParam) => [{ userId, offset: pageParam, limit: 10 }] as const
|
|
22
|
+
* : skipToken,
|
|
12
23
|
* initialPageParam: 0,
|
|
13
24
|
* getNextPageParam: (lastPage) => lastPage.nextOffset,
|
|
14
25
|
* })
|
|
15
26
|
*/
|
|
16
|
-
export const useActorInfiniteQuery = ({ reactor, functionName, getArgs, callConfig, queryKey, ...options }) => {
|
|
27
|
+
export const useActorInfiniteQuery = ({ reactor, functionName, getArgs, getKeyArgs, callConfig, queryKey, ...options }) => {
|
|
28
|
+
useMountQueryClient(reactor.queryClient);
|
|
17
29
|
// Always pass queryKey through generateQueryKey so it is merged with the
|
|
18
30
|
// reactor/function identity. Using the custom key verbatim would cause cache
|
|
19
31
|
// collisions if two different actors or methods share the same key string.
|
|
20
|
-
const baseQueryKey = useMemo(() =>
|
|
21
|
-
|
|
32
|
+
const baseQueryKey = useMemo(() => {
|
|
33
|
+
// Waiting for its args: an entry of its own under the method and the
|
|
34
|
+
// custom key, which every key the args will give extends; see
|
|
35
|
+
// skippedQueryKey.
|
|
36
|
+
if (getArgs === skipToken) {
|
|
37
|
+
return skippedQueryKey(reactor.generateQueryKey({ functionName, queryKey: mergeFactoryQueryKey(queryKey) }, callConfig), "infinite");
|
|
38
|
+
}
|
|
22
39
|
// Fold the call arguments into the key. They live in the `getArgs`
|
|
23
40
|
// closure rather than in the config, so without this two hooks on the
|
|
24
|
-
// same method with different arguments share one cache entry and
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
// same method with different arguments share one cache entry and serve
|
|
42
|
+
// each other's pages. `getKeyArgs` narrows them exactly as it does for the
|
|
43
|
+
// factories, which the bound hook's config type always accepted: it used
|
|
44
|
+
// to be ignored here, so the cursor stayed in the key, and an
|
|
45
|
+
// `initialPageParam` that changes every render (`Date.now()`) keyed a new
|
|
46
|
+
// query on every render — an endless loop of first-page fetches.
|
|
47
|
+
const initialArgs = getArgs(options.initialPageParam);
|
|
48
|
+
const keyArgs = getKeyArgs?.(initialArgs) ?? initialArgs;
|
|
49
|
+
return reactor.generateQueryKey({
|
|
50
|
+
functionName,
|
|
51
|
+
queryKey: mergeFactoryQueryKey(queryKey, undefined, keyArgs),
|
|
52
|
+
}, callConfig);
|
|
53
|
+
}, [
|
|
28
54
|
queryKey,
|
|
29
55
|
reactor,
|
|
30
56
|
// `canisterId` is mutable reactor state that `setCanisterId` can change,
|
|
@@ -35,22 +61,29 @@ export const useActorInfiniteQuery = ({ reactor, functionName, getArgs, callConf
|
|
|
35
61
|
functionName,
|
|
36
62
|
callConfig,
|
|
37
63
|
getArgs,
|
|
64
|
+
getKeyArgs,
|
|
38
65
|
options.initialPageParam,
|
|
39
66
|
]);
|
|
40
67
|
// Memoize queryFn to prevent recreation on every render
|
|
41
|
-
const queryFn =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
68
|
+
const queryFn = useMemo(() => getArgs === skipToken
|
|
69
|
+
? skipToken
|
|
70
|
+
: async ({ pageParam, queryKey: fetchedKey, }) => {
|
|
71
|
+
const args = getArgs(pageParam);
|
|
72
|
+
const result = await reactor.callMethod({
|
|
73
|
+
functionName,
|
|
74
|
+
args,
|
|
75
|
+
callConfig: callConfigForKey(fetchedKey, callConfig),
|
|
76
|
+
});
|
|
77
|
+
return normalizeQueryData(result);
|
|
78
|
+
}, [reactor, functionName, getArgs, callConfig]);
|
|
79
|
+
// The method's default `retry`: for an update method, only failures that
|
|
80
|
+
// prove the canister never ran the call; see `Reactor.getQueryRetry`.
|
|
81
|
+
const defaultRetry = useMemo(() => reactor.getQueryRetry(functionName, baseQueryKey), [reactor, functionName, baseQueryKey]);
|
|
50
82
|
return useInfiniteQuery({
|
|
51
83
|
queryKey: baseQueryKey,
|
|
52
84
|
queryFn,
|
|
53
85
|
...options,
|
|
86
|
+
...retryOption(options.retry, defaultRetry),
|
|
54
87
|
}, reactor.queryClient);
|
|
55
88
|
};
|
|
56
89
|
//# sourceMappingURL=useActorInfiniteQuery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActorInfiniteQuery.js","sourceRoot":"","sources":["../../src/hooks/useActorInfiniteQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useActorInfiniteQuery.js","sourceRoot":"","sources":["../../src/hooks/useActorInfiniteQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAEL,gBAAgB,EAChB,SAAS,GAKV,MAAM,uBAAuB,CAAA;AAW9B,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,mBAAmB,GACpB,MAAM,aAAa,CAAA;AAmGpB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CASnC,EACA,OAAO,EACP,YAAY,EACZ,OAAO,EACP,UAAU,EACV,UAAU,EACV,QAAQ,EACR,GAAG,OAAO,EAOX,EAMC,EAAE;IACF,mBAAmB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAExC,yEAAyE;IACzE,6EAA6E;IAC7E,2EAA2E;IAC3E,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,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J,UAAU,EAAE,gBAAgB,CAAC,UAAU,EAAE,UAAU,CAAC;aACrD,CAAC,CAAA;YACF,OAAO,kBAAkB,CAEvB,MAAqD,CAAC,CAAA;QAC1D,CAAC,EACP,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,CAAC,CAC7C,CAAA;IAED,yEAAyE;IACzE,sEAAsE;IACtE,MAAM,YAAY,GAAG,OAAO,CAC1B,GAAG,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,YAAY,EAAE,YAAY,CAAC,EACvD,CAAC,OAAO,EAAE,YAAY,EAAE,YAAY,CAAC,CACtC,CAAA;IAED,OAAO,gBAAgB,CACrB;QACE,QAAQ,EAAE,YAAY;QACtB,OAAO;QACP,GAAG,OAAO;QACV,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,YAAY,CAAC;KACrC,EACR,OAAO,CAAC,WAAW,CAOpB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type UseQueryResult, type UseMutationResult, type QueryKey, type QueryObserverOptions } from "@tanstack/react-query";
|
|
2
2
|
import { Reactor, BaseActor, FunctionName, TransformKey, ReactorArgs, ReactorReturnOk, ReactorQueryData, ReactorReturnErr, FunctionType } from "@ic-reactor/core";
|
|
3
3
|
import { CallConfig } from "@icp-sdk/core/agent";
|
|
4
|
+
import type { InvalidationTarget } from "../types.js";
|
|
4
5
|
/**
|
|
5
6
|
* Configuration for useActorMethod hook.
|
|
6
7
|
* Extends react-query's QueryObserverOptions with custom reactor params.
|
|
@@ -8,6 +9,13 @@ import { CallConfig } from "@icp-sdk/core/agent";
|
|
|
8
9
|
* This is a unified hook that handles both query and mutation methods.
|
|
9
10
|
* Query-specific options (like refetchInterval) only apply to query methods.
|
|
10
11
|
* Mutation-specific options (like invalidateQueries) only apply to mutation methods.
|
|
12
|
+
*
|
|
13
|
+
* `retry`, `retryDelay`, `networkMode` and `meta` decide how a call runs, so
|
|
14
|
+
* they apply to both. An update method's call is a mutation: without a `retry`
|
|
15
|
+
* here it follows the QueryClient's mutation defaults, which retry nothing
|
|
16
|
+
* unless the app set `mutations.retry`, because each attempt runs the update
|
|
17
|
+
* on the canister again. Its query defaults, such as `reactorRetry`, do not
|
|
18
|
+
* apply to it.
|
|
11
19
|
*/
|
|
12
20
|
export interface UseActorMethodParameters<Service = BaseActor, Method extends FunctionName<Service> = FunctionName<Service>, Transform extends TransformKey = "candid"> extends Omit<QueryObserverOptions<ReactorQueryData<ReactorReturnOk<Service, Method, Transform>>, ReactorReturnErr<Service, Method, Transform>, ReactorQueryData<ReactorReturnOk<Service, Method, Transform>>, ReactorQueryData<ReactorReturnOk<Service, Method, Transform>>, QueryKey>, "queryKey" | "queryFn"> {
|
|
13
21
|
/** The reactor instance to use for method calls */
|
|
@@ -34,10 +42,19 @@ export interface UseActorMethodParameters<Service = BaseActor, Method extends Fu
|
|
|
34
42
|
*/
|
|
35
43
|
onError?: (error: ReactorReturnErr<Service, Method, Transform>) => void;
|
|
36
44
|
/**
|
|
37
|
-
*
|
|
45
|
+
* Queries to invalidate after a successful mutation.
|
|
38
46
|
* Only applies to mutation methods (updates).
|
|
47
|
+
*
|
|
48
|
+
* Each entry is a query key, a query object or query factory, or a
|
|
49
|
+
* `{ functionName, args? }` method of `reactor`; see
|
|
50
|
+
* {@link InvalidationTarget}. `undefined` entries are skipped.
|
|
51
|
+
*
|
|
52
|
+
* The invalidation is awaited before `onSuccess` runs, as in
|
|
53
|
+
* `useActorMutation` and `createMutation`, so `onSuccess` sees the
|
|
54
|
+
* refetched data, and `call()` resolves once the invalidated queries in use
|
|
55
|
+
* have refetched.
|
|
39
56
|
*/
|
|
40
|
-
invalidateQueries?:
|
|
57
|
+
invalidateQueries?: InvalidationTarget<Service, Transform>[];
|
|
41
58
|
}
|
|
42
59
|
/**
|
|
43
60
|
* Configuration type for bound useActorMethod hook (reactor omitted).
|
|
@@ -51,8 +68,9 @@ export type UseActorMethodConfig<Service = BaseActor, Method extends FunctionNam
|
|
|
51
68
|
export interface UseActorMethodResult<Service = BaseActor, Method extends FunctionName<Service> = FunctionName<Service>, Transform extends TransformKey = "candid"> {
|
|
52
69
|
/**
|
|
53
70
|
* The returned data from the method call. A method's `undefined` result is
|
|
54
|
-
* `null` here, as in `useActorQuery`, so `undefined`
|
|
55
|
-
* settled yet
|
|
71
|
+
* `null` here, as in `useActorQuery`, so `undefined` means that no call has
|
|
72
|
+
* settled yet, that the last call failed, or that an update call is
|
|
73
|
+
* running. A query keeps its earlier data when a refetch fails.
|
|
56
74
|
*/
|
|
57
75
|
data: ReactorQueryData<ReactorReturnOk<Service, Method, Transform>> | undefined;
|
|
58
76
|
/** Whether the method is currently executing */
|
|
@@ -73,6 +91,15 @@ export interface UseActorMethodResult<Service = BaseActor, Method extends Functi
|
|
|
73
91
|
* Call the method with optional arguments.
|
|
74
92
|
* For queries: triggers a refetch
|
|
75
93
|
* For mutations: executes the mutation with the provided args
|
|
94
|
+
*
|
|
95
|
+
* For a query method, `call(args)` fetches those args from the canister
|
|
96
|
+
* even when they are cached, and reports the result to `onSuccess` or
|
|
97
|
+
* `onError` itself. `call()` refetches the hook's own args, as `refetch()`
|
|
98
|
+
* does. Either resolves `undefined` when its fetch fails. A sign-in or
|
|
99
|
+
* sign-out while either is in flight cancels the fetch, which then runs
|
|
100
|
+
* again for the principal signed in, so the call resolves with that
|
|
101
|
+
* principal's answer rather than the previous one's; see
|
|
102
|
+
* `ClientManager.fetchAcrossIdentitySwitch`.
|
|
76
103
|
*/
|
|
77
104
|
call: (args?: ReactorArgs<Service, Method, Transform>) => Promise<ReactorQueryData<ReactorReturnOk<Service, Method, Transform>> | undefined>;
|
|
78
105
|
/**
|
|
@@ -86,6 +113,12 @@ export interface UseActorMethodResult<Service = BaseActor, Method extends Functi
|
|
|
86
113
|
reset: () => void;
|
|
87
114
|
/**
|
|
88
115
|
* For queries only: Refetch the query
|
|
116
|
+
*
|
|
117
|
+
* Resolves with the answer, or `undefined` when the refetch fails, whose
|
|
118
|
+
* error the hook reports to `onError`; `data` keeps the last answer. A
|
|
119
|
+
* sign-in or sign-out while it is in flight makes it refetch for the
|
|
120
|
+
* principal signed in, and it resolves with that principal's answer, as
|
|
121
|
+
* `call()` does.
|
|
89
122
|
*/
|
|
90
123
|
refetch: () => Promise<ReactorQueryData<ReactorReturnOk<Service, Method, Transform>> | undefined>;
|
|
91
124
|
/** The raw query result (only available for query methods) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActorMethod.d.ts","sourceRoot":"","sources":["../../src/hooks/useActorMethod.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useActorMethod.d.ts","sourceRoot":"","sources":["../../src/hooks/useActorMethod.ts"],"names":[],"mappings":"AAOA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,OAAO,EACP,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACb,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAOhD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,wBAAwB,CACvC,OAAO,GAAG,SAAS,EACnB,MAAM,SAAS,YAAY,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,EAC5D,SAAS,SAAS,YAAY,GAAG,QAAQ,CACzC,SAAQ,IAAI,CACZ,oBAAoB,CAClB,gBAAgB,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,EAC7D,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAC5C,gBAAgB,CAAC,eAAe,C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