@ic-reactor/react 3.8.0 → 3.9.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.
Files changed (53) hide show
  1. package/README.md +68 -3
  2. package/dist/auth/authentication-manager.d.ts.map +1 -1
  3. package/dist/auth/authentication-manager.js +137 -21
  4. package/dist/auth/authentication-manager.js.map +1 -1
  5. package/dist/createInfiniteQuery.d.ts +11 -9
  6. package/dist/createInfiniteQuery.d.ts.map +1 -1
  7. package/dist/createInfiniteQuery.js +20 -17
  8. package/dist/createInfiniteQuery.js.map +1 -1
  9. package/dist/createMutation.d.ts.map +1 -1
  10. package/dist/createMutation.js +22 -2
  11. package/dist/createMutation.js.map +1 -1
  12. package/dist/createQuery.d.ts.map +1 -1
  13. package/dist/createQuery.js +5 -1
  14. package/dist/createQuery.js.map +1 -1
  15. package/dist/createSuspenseInfiniteQuery.d.ts +10 -9
  16. package/dist/createSuspenseInfiniteQuery.d.ts.map +1 -1
  17. package/dist/createSuspenseInfiniteQuery.js +18 -16
  18. package/dist/createSuspenseInfiniteQuery.js.map +1 -1
  19. package/dist/createSuspenseQuery.d.ts.map +1 -1
  20. package/dist/createSuspenseQuery.js +5 -1
  21. package/dist/createSuspenseQuery.js.map +1 -1
  22. package/dist/hooks/useActorInfiniteQuery.d.ts.map +1 -1
  23. package/dist/hooks/useActorInfiniteQuery.js +16 -2
  24. package/dist/hooks/useActorInfiniteQuery.js.map +1 -1
  25. package/dist/hooks/useActorMethod.d.ts.map +1 -1
  26. package/dist/hooks/useActorMethod.js +66 -33
  27. package/dist/hooks/useActorMethod.js.map +1 -1
  28. package/dist/hooks/useActorMutation.d.ts +8 -1
  29. package/dist/hooks/useActorMutation.d.ts.map +1 -1
  30. package/dist/hooks/useActorMutation.js +9 -1
  31. package/dist/hooks/useActorMutation.js.map +1 -1
  32. package/dist/hooks/useActorSuspenseInfiniteQuery.d.ts.map +1 -1
  33. package/dist/hooks/useActorSuspenseInfiniteQuery.js +16 -2
  34. package/dist/hooks/useActorSuspenseInfiniteQuery.js.map +1 -1
  35. package/dist/types.d.ts +8 -2
  36. package/dist/types.d.ts.map +1 -1
  37. package/dist/utils.d.ts +14 -5
  38. package/dist/utils.d.ts.map +1 -1
  39. package/dist/utils.js +21 -10
  40. package/dist/utils.js.map +1 -1
  41. package/package.json +2 -2
  42. package/src/auth/authentication-manager.ts +152 -21
  43. package/src/createInfiniteQuery.ts +48 -34
  44. package/src/createMutation.ts +32 -2
  45. package/src/createQuery.ts +8 -1
  46. package/src/createSuspenseInfiniteQuery.ts +44 -32
  47. package/src/createSuspenseQuery.ts +8 -1
  48. package/src/hooks/useActorInfiniteQuery.ts +25 -3
  49. package/src/hooks/useActorMethod.ts +82 -34
  50. package/src/hooks/useActorMutation.ts +19 -4
  51. package/src/hooks/useActorSuspenseInfiniteQuery.ts +25 -3
  52. package/src/types.ts +8 -2
  53. package/src/utils.ts +21 -10
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,uBAAuB,EACvB,SAAS,EACT,qBAAqB,EACtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EACL,QAAQ,EACR,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,uBAAuB,CAAA;AAQ9B,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,CAAA;AAKvD,uEAAuE;AACvE,MA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Y,CACb;IACC;;;;;;;;;OASG;IACH,iBAAiB,CAAC,EAAE,CAAC,QAAQ,GAAG,SAAS,CAAC,EAAE,CAAA;IAC5C;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,CAChB,KAAK,EAAE,aAAa,CAClB,uBAAuB,CACrB,SAAS,CAAC,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAClD,CAAC,SAAS,CAAC,CACb,EACD,SAAS,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,KAC/C,IAAI,CAAA;CACV;AAED;;GAEG;AACH,MAAM,WAAW,cAAc,CAC7B,OAAO,GAAG,SAAS,EACnB,MAAM,SAAS,YAAY,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,EAC5D,SAAS,SAAS,YAAY,GAAG,QAAQ;IAEzC;;;;;;;;;OASG;IACH,WAAW,EAAE,CACX,OAAO,CAAC,EAAE,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,KACtD,iBAAiB,CACpB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAC3C,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAC5C,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CACxC,CAAA;IAED,0DAA0D;IAC1D,OAAO,EAAE,CACP,IAAI,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,KAC1C,OAAO,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAA;CAC1D"}
package/dist/utils.d.ts CHANGED
@@ -19,11 +19,20 @@ export declare const normalizeQueryData: <T>(value: T) => ReactorQueryData<T>;
19
19
  */
20
20
  export declare function mergeFactoryQueryKey(baseQueryKey?: QueryKey, callQueryKey?: QueryKey, keyArgs?: unknown): QueryKey | undefined;
21
21
  /**
22
- * Build a chained select function that first applies the config-level select
23
- * (if any) and then the hook-level select (if any).
22
+ * Build a chained select that applies the config-level select (if any) and then
23
+ * the hook-level select (if any).
24
24
  *
25
- * This enables `createQuery` / `createSuspenseQuery` to support two-level
26
- * select chaining without duplicating the logic.
25
+ * Returns the caller's own function untouched when only one of the two is
26
+ * present, and `undefined` when neither is — allocating a wrapper only for the
27
+ * genuinely chained case. Identity matters here: `QueryObserver` memoizes a
28
+ * select result on `options.select === previousSelectFn`, so a wrapper rebuilt
29
+ * on every render defeats that check. The select then re-runs each render, and
30
+ * for a select returning a non-plain value (a `Map`, a `Date`, a `Principal`)
31
+ * `replaceEqualDeep` cannot structurally share the result either, so `data`
32
+ * gets a fresh reference every render and a `useEffect([data])` that sets state
33
+ * becomes an unbounded loop.
34
+ *
35
+ * Callers should still memoize the result, since the chained case allocates.
27
36
  */
28
- export declare function buildChainedSelect<TData, TSelected, TFinal = TSelected>(configSelect: ((data: TData) => TSelected) | undefined, hookSelect: ((data: TSelected) => TFinal) | undefined): (rawData: TData) => TSelected | TFinal;
37
+ export declare function buildChainedSelect<TData, TSelected, TFinal = TSelected>(configSelect: ((data: TData) => TSelected) | undefined, hookSelect: ((data: TSelected) => TFinal) | undefined): ((rawData: TData) => TSelected | TFinal) | undefined;
29
38
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAGxD;;;GAGG;AACH,eAAO,MAAM,0BAA0B,kCAAkC,CAAA;AAEzE,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAE,OAAO,CAAC,KAAG,gBAAgB,CAAC,CAAC,CACN,CAAA;AAE7D;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,Y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O,EAAE,KAAK,KAAK,SAAS,GAAG,MAAM,CAAC,GAAG,SAAS,CAStD"}
package/dist/utils.js CHANGED
@@ -32,18 +32,29 @@ export function mergeFactoryQueryKey(baseQueryKey, callQueryKey, keyArgs) {
32
32
  return merged.length > 0 ? merged : undefined;
33
33
  }
34
34
  /**
35
- * Build a chained select function that first applies the config-level select
36
- * (if any) and then the hook-level select (if any).
35
+ * Build a chained select that applies the config-level select (if any) and then
36
+ * the hook-level select (if any).
37
37
  *
38
- * This enables `createQuery` / `createSuspenseQuery` to support two-level
39
- * select chaining without duplicating the logic.
38
+ * Returns the caller's own function untouched when only one of the two is
39
+ * present, and `undefined` when neither is — allocating a wrapper only for the
40
+ * genuinely chained case. Identity matters here: `QueryObserver` memoizes a
41
+ * select result on `options.select === previousSelectFn`, so a wrapper rebuilt
42
+ * on every render defeats that check. The select then re-runs each render, and
43
+ * for a select returning a non-plain value (a `Map`, a `Date`, a `Principal`)
44
+ * `replaceEqualDeep` cannot structurally share the result either, so `data`
45
+ * gets a fresh reference every render and a `useEffect([data])` that sets state
46
+ * becomes an unbounded loop.
47
+ *
48
+ * Callers should still memoize the result, since the chained case allocates.
40
49
  */
41
50
  export function buildChainedSelect(configSelect, hookSelect) {
42
- return (rawData) => {
43
- const firstPass = configSelect
44
- ? configSelect(rawData)
45
- : rawData;
46
- return hookSelect ? hookSelect(firstPass) : firstPass;
47
- };
51
+ if (!configSelect) {
52
+ // `hookSelect` receives the raw data when there is no config-level select,
53
+ // matching the previous behaviour.
54
+ return hookSelect;
55
+ }
56
+ if (!hookSelect)
57
+ return configSelect;
58
+ return (rawData) => hookSelect(configSelect(rawData));
48
59
  }
49
60
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C;;;GAGG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AClB,2EAA2E;QAC3E,mCAAmC;QACnC,OAAO,UAC+C,CAAA;IACxD,CAAC;IACD,IAAI,CAAC,UAAU;QAAE,OAAO,YAAY,CAAA;IACpC,OAAO,CAAC,OAAc,EAAE,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAA;AAC9D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ic-reactor/react",
3
- "version": "3.8.0",
3
+ "version": "3.9.0",
4
4
  "description": "IC Reactor React library for building Internet Computer apps",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -50,7 +50,7 @@
50
50
  "author": "Behrad Deylami",
51
51
  "license": "MIT",
52
52
  "dependencies": {
53
- "@ic-reactor/core": "^3.8.0"
53
+ "@ic-reactor/core": "^3.9.0"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@icp-sdk/auth": "^7.1.0 || ^8.0.0",
@@ -6,8 +6,9 @@ import type {
6
6
  AuthenticationClientOptions,
7
7
  AuthenticationSignInOptions,
8
8
  } from "./types.js"
9
- import { ClientManager, isDev } from "@ic-reactor/core"
9
+ import { ClientManager, isDev, isMainnetHost } from "@ic-reactor/core"
10
10
 
11
+ import { Principal } from "@icp-sdk/core/principal"
11
12
  import { safeGetCanisterEnv } from "@icp-sdk/core/agent/canister-env"
12
13
  import {
13
14
  IC_INTERNET_IDENTITY_PROVIDER,
@@ -80,13 +81,18 @@ export class AuthenticationManager {
80
81
  typeof window !== "undefined" ? getAuthenticationCanisterEnv() : undefined
81
82
  this.identityProvider =
82
83
  identityProvider ||
83
- canisterEnv?.[INTERNET_IDENTITY_PROVIDER_ENV_KEY] ||
84
- canisterEnv?.["PUBLIC_INTERNET_IDENTITY_PROVIDER"]
84
+ acceptEnvIdentityProvider(
85
+ canisterEnv?.[INTERNET_IDENTITY_PROVIDER_ENV_KEY] ||
86
+ canisterEnv?.["PUBLIC_INTERNET_IDENTITY_PROVIDER"],
87
+ clientManager
88
+ )
85
89
  this.internetIdentityId =
86
90
  internetIdentityId ||
87
- canisterEnv?.["internet_identity"] ||
88
- canisterEnv?.["PUBLIC_CANISTER_ID:internet_identity"] ||
89
- canisterEnv?.["CANISTER_ID_INTERNET_IDENTITY"]
91
+ acceptEnvCanisterId(
92
+ canisterEnv?.["internet_identity"] ||
93
+ canisterEnv?.["PUBLIC_CANISTER_ID:internet_identity"] ||
94
+ canisterEnv?.["CANISTER_ID_INTERNET_IDENTITY"]
95
+ )
90
96
  this.defaultClientOptions = clientOptions
91
97
 
92
98
  if (authClient) {
@@ -150,7 +156,24 @@ export class AuthenticationManager {
150
156
 
151
157
  public authenticate = async (): Promise<Identity | undefined> => {
152
158
  if (this.authState.isAuthenticated) {
153
- return this.authState.identity || undefined
159
+ // Returning on the cached flag alone meant a delegation that expired
160
+ // mid-session was never re-observed: the UI kept rendering a signed-in
161
+ // state while every update call failed, and only a reload recovered.
162
+ // Re-ask the client, which reads the cached expiry rather than hitting
163
+ // storage. A throw here is treated as "still valid" so a transient
164
+ // failure cannot sign anyone out.
165
+ if (!this.authClient) {
166
+ return this.authState.identity || undefined
167
+ }
168
+ const stillValid = await Promise.resolve(
169
+ this.authClient.isAuthenticated()
170
+ ).catch(() => true)
171
+ if (stillValid) {
172
+ return this.authState.identity || undefined
173
+ }
174
+ // Expired — drop the stale flag and fall through to re-derive state,
175
+ // which resets the agent to the anonymous identity.
176
+ this.updateState({ isAuthenticated: false })
154
177
  }
155
178
  if (this.authPromise) {
156
179
  return this.authPromise
@@ -273,14 +296,22 @@ export class AuthenticationManager {
273
296
  )
274
297
  }
275
298
  this.updateState({ isAuthenticating: true, error: undefined })
276
- await this.authClient.signOut(options)
277
- const identity = await this.authClient.getIdentity()
278
- this.clientManager.updateAgent(identity)
279
- this.updateState({
280
- identity,
281
- isAuthenticated: false,
282
- isAuthenticating: false,
283
- })
299
+ try {
300
+ await this.authClient.signOut(options)
301
+ const identity = await this.authClient.getIdentity()
302
+ this.clientManager.updateAgent(identity)
303
+ this.updateState({
304
+ identity,
305
+ isAuthenticated: false,
306
+ isAuthenticating: false,
307
+ })
308
+ } catch (error) {
309
+ // Without this the manager was left with `isAuthenticating: true` and no
310
+ // recorded error, so a button disabled on `isAuthenticating` stayed stuck
311
+ // and nothing told the app why.
312
+ this.updateState({ error: error as Error, isAuthenticating: false })
313
+ throw error
314
+ }
284
315
  }
285
316
 
286
317
  private async initializeClient(
@@ -449,12 +480,7 @@ export class AuthenticationManager {
449
480
  }
450
481
 
451
482
  if (!this.authClientConstructorPromise) {
452
- // The specifier must stay a literal: a variable specifier (or /* @vite-ignore */)
453
- // makes bundlers skip this import entirely, so the bare specifier survives into
454
- // the browser, where it cannot be resolved without an import map and every login
455
- // path fails. A literal lets Vite/Rollup/webpack code-split the optional peer,
456
- // and lets them tree-shake it away for apps that never reference this class.
457
- this.authClientConstructorPromise = import("@icp-sdk/auth/client")
483
+ this.authClientConstructorPromise = importAuthClientModule()
458
484
  .then((authModule) => {
459
485
  const AuthClient = (
460
486
  authModule as { AuthClient?: AuthClientConstructor }
@@ -484,6 +510,37 @@ export class AuthenticationManager {
484
510
  }
485
511
  }
486
512
 
513
+ /**
514
+ * Loads the optional `@icp-sdk/auth` peer.
515
+ *
516
+ * The `try` is load-bearing, not defensive. webpack flags a dynamic import
517
+ * that sits lexically inside a `try` block as an *optional* dependency
518
+ * (`ImportParserPlugin`: `dep.optional = Boolean(parser.scope.inTry)`), and
519
+ * `Compilation` reports an unresolvable optional dependency as a build
520
+ * *warning* instead of a fatal "Module not found" error, emitting a module
521
+ * that rejects at runtime. Without the `try`, every webpack-based toolchain
522
+ * (webpack, `next build --webpack`, Rspack) fails to build for consumers who
523
+ * never touch authentication, because npm/pnpm do not install optional peers.
524
+ * Do not hoist this import out of the `try`, and do not wrap it in a nested
525
+ * function — webpack resets `inTry` at every function boundary.
526
+ *
527
+ * The specifier must also stay a literal: a variable specifier (or
528
+ * `@vite-ignore`) makes bundlers skip this import entirely, so the bare
529
+ * specifier survives into the browser, where it cannot be resolved without an
530
+ * import map and every login path fails. A literal lets Vite/Rollup/webpack
531
+ * code-split the optional peer, and lets them tree-shake it away for apps that
532
+ * never reference this class.
533
+ */
534
+ function importAuthClientModule(): Promise<unknown> {
535
+ try {
536
+ return import("@icp-sdk/auth/client")
537
+ } catch (error) {
538
+ // Native ESM without an import map (and bundlers that neither resolve nor
539
+ // stub the specifier) throw synchronously rather than rejecting.
540
+ return Promise.reject(error)
541
+ }
542
+ }
543
+
487
544
  function getAuthClientOptions(
488
545
  options?: AuthenticationClientOptions
489
546
  ): AuthenticationClientOptions | undefined {
@@ -545,6 +602,80 @@ function isSameAuthClientOptions(
545
602
  )
546
603
  }
547
604
 
605
+ /**
606
+ * Decides whether an Internet Identity provider carried by the `ic_env` cookie
607
+ * may be used.
608
+ *
609
+ * The cookie is written by the replica serving a local or testnet deployment,
610
+ * and it is only authoritative in that setting: cookies are not origin-isolated
611
+ * the way script-accessible storage is, so on a mainnet deployment the identity
612
+ * provider is configuration that belongs in code rather than something read
613
+ * back out of the environment at runtime. `AuthClient` treats `identityProvider`
614
+ * as trusted developer configuration and does not re-check it.
615
+ *
616
+ * This mirrors the root-key guard in `ClientManager` (see `packages/core`):
617
+ * both values arrive from the same cookie and get the same treatment — adopted
618
+ * off-mainnet, ignored on mainnet in favour of the pinned default.
619
+ *
620
+ * A provider on the app's own origin is always accepted: it is exactly as
621
+ * trustworthy as the page doing the asking. Callers that need a custom provider
622
+ * on mainnet pass `identityProvider` explicitly.
623
+ */
624
+ function acceptEnvIdentityProvider(
625
+ value: string | undefined,
626
+ clientManager: ClientManager
627
+ ): string | undefined {
628
+ if (!value) return undefined
629
+
630
+ const pageOrigin =
631
+ typeof window !== "undefined" ? window.location?.origin : undefined
632
+
633
+ let url: URL
634
+ try {
635
+ url = new URL(value, pageOrigin)
636
+ } catch {
637
+ return undefined
638
+ }
639
+
640
+ if (pageOrigin && url.origin === pageOrigin) {
641
+ return url.toString()
642
+ }
643
+
644
+ // `isMainnetHost` matches only the real boundary domains and defaults to true
645
+ // for an unknown host, so custom testnets keep working while anything that
646
+ // looks like mainnet fails closed. `clientManager.isLocal` would be wrong
647
+ // here: it treats every unrecognized hostname as "ic".
648
+ if (isMainnetHost(clientManager.agentHost?.toString())) {
649
+ console.warn(
650
+ `[ic-reactor] Ignoring the Internet Identity provider from the ic_env cookie ` +
651
+ `("${url.origin}") because this reactor targets mainnet, where the provider ` +
652
+ `is taken from configuration rather than the environment. Pass ` +
653
+ `\`identityProvider\` to AuthenticationManager to use a custom provider on mainnet.`
654
+ )
655
+ return undefined
656
+ }
657
+
658
+ return url.toString()
659
+ }
660
+
661
+ /**
662
+ * Accepts an Internet Identity canister ID from `ic_env` only when it parses as
663
+ * a principal.
664
+ *
665
+ * The value is interpolated into a provider URL
666
+ * (`http://<id>.localhost:<port>/authorize`), so anything that is not a bare
667
+ * principal can change the shape of that URL rather than just its subdomain.
668
+ * Only reachable on local networks, since mainnet uses the pinned provider.
669
+ */
670
+ function acceptEnvCanisterId(value: string | undefined): string | undefined {
671
+ if (!value) return undefined
672
+ try {
673
+ return Principal.fromText(value).toText()
674
+ } catch {
675
+ return undefined
676
+ }
677
+ }
678
+
548
679
  function getAuthenticationCanisterEnv(): Record<string, string> | undefined {
549
680
  const canisterEnv = safeGetCanisterEnv<Record<string, string>>()
550
681
  if (canisterEnv) {
@@ -22,6 +22,7 @@
22
22
  * postsQuery.invalidate()
23
23
  */
24
24
 
25
+ import { useMemo } from "react"
25
26
  import type {
26
27
  Reactor,
27
28
  FunctionName,
@@ -44,7 +45,11 @@ import {
44
45
  } from "@tanstack/react-query"
45
46
  import { CallConfig } from "@icp-sdk/core/agent"
46
47
  import { NoInfer } from "./types.js"
47
- import { mergeFactoryQueryKey, normalizeQueryData } from "./utils.js"
48
+ import {
49
+ buildChainedSelect,
50
+ mergeFactoryQueryKey,
51
+ normalizeQueryData,
52
+ } from "./utils.js"
48
53
 
49
54
  type InfiniteQueryFactoryFn<
50
55
  Service,
@@ -126,6 +131,16 @@ export interface InfiniteQueryConfig<
126
131
  initialPageParam: TPageParam
127
132
  /** Function to get args from page parameter */
128
133
  getArgs: (pageParam: TPageParam) => ReactorArgs<Service, Method, Transform>
134
+ /**
135
+ * Narrows what the cache key derives from the call arguments.
136
+ *
137
+ * By default the key is scoped by `getArgs(initialPageParam)`, so two
138
+ * infinite queries on the same method with different arguments stay in
139
+ * separate cache entries. Supply this when those args embed the cursor and
140
+ * only part of them identifies the query — return the stable, serializable
141
+ * portion (typically everything except the pagination field).
142
+ */
143
+ getKeyArgs?: (args: ReactorArgs<Service, Method, Transform>) => unknown
129
144
  /** Function to determine next page parameter */
130
145
  getNextPageParam: (
131
146
  lastPage: InfiniteQueryPageData<Service, Method, Transform>,
@@ -155,17 +170,12 @@ export type InfiniteQueryFactoryConfig<
155
170
  TPageParam
156
171
  >,
157
172
  > = Omit<
173
+ // `getArgs` is supplied per factory call. `getKeyArgs` is inherited from
174
+ // InfiniteQueryConfig, which now applies it for every infinite query rather
175
+ // than only for factory-created ones.
158
176
  InfiniteQueryConfig<Service, Method, Transform, TPageParam, Selected>,
159
177
  "getArgs"
160
- > & {
161
- /**
162
- * Optional key-args derivation for factory calls.
163
- * Receives the resolved args from `getArgs(initialPageParam)` and should return
164
- * a stable serializable representation of the logical query identity
165
- * (typically excluding pagination/cursor fields).
166
- */
167
- getKeyArgs?: (args: ReactorArgs<Service, Method, Transform>) => unknown
168
- }
178
+ >
169
179
 
170
180
  // ============================================================================
171
181
  // Hook Interface
@@ -292,6 +302,7 @@ const createInfiniteQueryImpl = <
292
302
  queryKey: customQueryKey,
293
303
  initialPageParam,
294
304
  getArgs,
305
+ getKeyArgs,
295
306
  getNextPageParam,
296
307
  getPreviousPageParam,
297
308
  maxPages,
@@ -300,12 +311,22 @@ const createInfiniteQueryImpl = <
300
311
  ...rest
301
312
  } = config
302
313
 
303
- // Get query key from actor manager
314
+ // Fold the call arguments into the key. Without them every infinite query on
315
+ // a method shares one cache entry, so two lists with different `getArgs` (a
316
+ // different page size, a different filter) serve each other's pages — the
317
+ // arguments live in a closure, not in the config, so nothing else
318
+ // distinguishes them.
319
+ //
320
+ // The first page's args stand for the query's identity; `getKeyArgs` lets a
321
+ // caller drop the cursor field when it is part of those args.
304
322
  const getQueryKey = (): QueryKey => {
323
+ const initialArgs = getArgs(initialPageParam)
324
+ const keyArgs = getKeyArgs?.(initialArgs) ?? initialArgs
325
+
305
326
  return reactor.generateQueryKey(
306
327
  {
307
328
  functionName,
308
- queryKey: customQueryKey,
329
+ queryKey: mergeFactoryQueryKey(customQueryKey, undefined, keyArgs),
309
330
  },
310
331
  callConfig
311
332
  )
@@ -368,14 +389,12 @@ const createInfiniteQueryImpl = <
368
389
  Selected,
369
390
  TError
370
391
  > = (options: any): any => {
371
- // Chain the selects: raw -> config.select -> options.select
372
- const chainedSelect = (rawData: TInfiniteData) => {
373
- const firstPass = select ? select(rawData) : rawData
374
- if (options?.select) {
375
- return options.select(firstPass)
376
- }
377
- return firstPass
378
- }
392
+ // Memoized and identity-preserving; see buildChainedSelect for why the
393
+ // function identity matters to the observer's select-result cache.
394
+ const chainedSelect = useMemo(
395
+ () => buildChainedSelect(select as never, options?.select),
396
+ [options?.select]
397
+ )
379
398
 
380
399
  return useInfiniteQuery(
381
400
  {
@@ -535,10 +554,8 @@ export function createInfiniteQueryFactory<
535
554
  > = (
536
555
  getArgs: (pageParam: TPageParam) => ReactorArgs<Service, Method, Transform>
537
556
  ) => {
538
- const initialArgs = getArgs(config.initialPageParam)
539
- const keyArgs = config.getKeyArgs?.(initialArgs) ?? initialArgs
540
- const queryKey = mergeFactoryQueryKey(config.queryKey, undefined, keyArgs)
541
-
557
+ // `getKeyArgs` and the args-derived key segment are applied by the impl,
558
+ // which now does it for every infinite query rather than only for factories.
542
559
  return createInfiniteQueryImpl<
543
560
  Service,
544
561
  Method,
@@ -546,16 +563,13 @@ export function createInfiniteQueryFactory<
546
563
  TPageParam,
547
564
  Selected
548
565
  >(reactor, {
549
- ...(({ getKeyArgs: _getKeyArgs, ...rest }) => rest)(
550
- config as InfiniteQueryFactoryConfig<
551
- Service,
552
- Method,
553
- Transform,
554
- TPageParam,
555
- Selected
556
- >
557
- ),
558
- queryKey,
566
+ ...(config as InfiniteQueryFactoryConfig<
567
+ Service,
568
+ Method,
569
+ Transform,
570
+ TPageParam,
571
+ Selected
572
+ >),
559
573
  getArgs,
560
574
  })
561
575
  }
@@ -91,16 +91,46 @@ const createMutationImpl = <
91
91
 
92
92
  /**
93
93
  * Imperative execution for non-React usage.
94
- * Calls the canister method and invalidates factory-level queries.
94
+ *
95
+ * Runs the same factory-level chain the hook does — invalidation, then
96
+ * `onSuccess`, or `onCanisterError`/`onError` on failure — so a mutation
97
+ * object behaves the same through both call paths. Only hook-level callbacks
98
+ * are absent, because there is no hook here to supply them.
99
+ *
100
+ * The error is rethrown after the callbacks run, so `await execute(...)`
101
+ * still rejects for the caller.
102
+ *
95
103
  * Use this in route loaders, scripts, or server-side code.
96
104
  */
97
105
  const execute = async (
98
106
  args: ReactorArgs<Service, Method, Transform>
99
107
  ): Promise<ReactorReturnOk<Service, Method, Transform>> => {
100
- const result = await callFn(args)
108
+ let result: ReactorReturnOk<Service, Method, Transform>
109
+ try {
110
+ result = await callFn(args)
111
+ } catch (error) {
112
+ if (isCanisterError(error)) {
113
+ factoryOnCanisterError?.(error, args)
114
+ }
115
+ // No mutation context or instance exists on the imperative path.
116
+ factoryOnError?.(
117
+ error as Parameters<NonNullable<typeof factoryOnError>>[0],
118
+ args,
119
+ undefined as never,
120
+ undefined as never
121
+ )
122
+ throw error
123
+ }
124
+
101
125
  if (factoryInvalidateQueries) {
102
126
  await invalidateAll(reactor.queryClient, factoryInvalidateQueries)
103
127
  }
128
+ await factoryOnSuccess?.(
129
+ result,
130
+ args,
131
+ undefined as never,
132
+ undefined as never
133
+ )
104
134
  return result
105
135
  }
106
136
 
@@ -30,6 +30,7 @@ import type {
30
30
  ReactorArgs,
31
31
  TransformKey,
32
32
  } from "@ic-reactor/core"
33
+ import { useMemo } from "react"
33
34
  import {
34
35
  QueryKey,
35
36
  useQuery,
@@ -110,6 +111,12 @@ const createQueryImpl = <
110
111
 
111
112
  const useQueryHook = ((options?: UseQueryHookOptions) => {
112
113
  const baseOptions = reactor.getQueryOptions(params)
114
+ // Memoized so the observer's select-result cache can hit; see
115
+ // buildChainedSelect. `select` comes from the factory config and is stable.
116
+ const chainedSelect = useMemo(
117
+ () => buildChainedSelect(select, options?.select),
118
+ [options?.select]
119
+ )
113
120
  return useQuery(
114
121
  {
115
122
  queryKey: baseOptions.queryKey,
@@ -117,7 +124,7 @@ const createQueryImpl = <
117
124
  ...rest,
118
125
  ...options,
119
126
  queryFn: baseOptions.queryFn,
120
- select: buildChainedSelect(select, options?.select),
127
+ select: chainedSelect,
121
128
  },
122
129
  reactor.queryClient
123
130
  )