@canonical/router-react 0.48.0 → 0.50.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 CHANGED
@@ -104,11 +104,17 @@ All hooks and `Link` default to `RegisteredRouteMap`. Register your route map on
104
104
  declare module "@canonical/router-react" {
105
105
  interface RouterRegister {
106
106
  routes: typeof routes;
107
+ meta: AppRouteMeta; // optional: types every route's `meta`
108
+ context: AppContext; // optional: types the value every `warm` receives
107
109
  }
108
110
  }
109
111
  ```
110
112
 
111
- Explicit generics (`<typeof routes>`) still work as an escape hatch for multi-router apps or library code.
113
+ A declared `meta` is checked at each `route()` call and typed wherever a route is read (`router.routes[name].meta`, `match.route.meta`). Without it, `meta` is `Readonly<Record<string, unknown>>`.
114
+
115
+ A declared `context` types the `context` option of `createRouter` and the `context` every `warm` receives (see [Data ownership](#data-ownership)). Once declared, `createRouter` requires the option. Without it, `context` is optional and typed `unknown`. The declaration covers the whole program: every `createRouter` call must then pass `context`, including test routers, a server-side matcher router and Storybook routers. To keep the option optional, declare `context: AppContext | undefined`.
116
+
117
+ Explicit generics (`<typeof routes>`) still work as an escape hatch for multi-router apps or library code. They cover the route map only: `meta` and `context` come from the declaration alone.
112
118
 
113
119
  Important distinction:
114
120
 
@@ -140,6 +146,49 @@ function UserProfile({ id }: { id: string }) {
140
146
  }
141
147
  ```
142
148
 
149
+ When `warm()` needs an application value, such as a Relay environment or the query client, pass it as `createRouter`'s `context` option rather than importing a module-level singleton. On the server, each request builds its router with its own value:
150
+
151
+ ```tsx
152
+ const entityRoute = route({
153
+ url: "/entities/:uri",
154
+ // Resolve when the data is in the store, so the server's warmRoute can
155
+ // wait for it; end the subscription when `signal` aborts, which cancels
156
+ // the request.
157
+ warm: ({ uri }, _search, { signal, context }) =>
158
+ new Promise<void>((resolve, reject) => {
159
+ if (signal.aborted) return resolve();
160
+ let subscription: { unsubscribe(): void } | undefined;
161
+ const stop = () => {
162
+ subscription?.unsubscribe();
163
+ resolve();
164
+ };
165
+ // Listen first: a query the store already holds completes during
166
+ // subscribe, and its completion must remove the listener.
167
+ signal.addEventListener("abort", stop, { once: true });
168
+ subscription = fetchQuery(
169
+ context.environment,
170
+ EntityPageQuery,
171
+ { uri },
172
+ { fetchPolicy: "store-or-network" },
173
+ ).subscribe({
174
+ complete: () => {
175
+ signal.removeEventListener("abort", stop);
176
+ resolve();
177
+ },
178
+ error: (error: Error) => {
179
+ signal.removeEventListener("abort", stop);
180
+ reject(error);
181
+ },
182
+ });
183
+ }),
184
+ content: ({ params }) => <EntityPage uri={params.uri} />,
185
+ });
186
+
187
+ const router = createRouter({ entity: entityRoute }, { adapter, context: { environment } });
188
+ ```
189
+
190
+ The value reaches `warm()` only: there is no hook for it, and components get their environment from their data library's own provider.
191
+
143
192
  ## Error handling
144
193
 
145
194
  Errors travel through two separate channels. Knowing which one you are in tells you which tool to reach for.
@@ -182,19 +231,30 @@ import { Component, type ReactNode } from "react";
182
231
  interface ErrorBoundaryProps {
183
232
  readonly children: ReactNode;
184
233
  readonly fallback: (error: unknown) => ReactNode;
234
+ readonly resetKey: string;
185
235
  }
186
236
 
187
237
  interface ErrorBoundaryState {
188
238
  readonly error: unknown | null;
239
+ readonly resetKey: string;
189
240
  }
190
241
 
191
242
  class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
192
- state: ErrorBoundaryState = { error: null };
243
+ state: ErrorBoundaryState = { error: null, resetKey: this.props.resetKey };
193
244
 
194
- static getDerivedStateFromError(error: unknown): ErrorBoundaryState {
245
+ static getDerivedStateFromError(error: unknown): Partial<ErrorBoundaryState> {
195
246
  return { error };
196
247
  }
197
248
 
249
+ static getDerivedStateFromProps(
250
+ props: ErrorBoundaryProps,
251
+ state: ErrorBoundaryState,
252
+ ): ErrorBoundaryState | null {
253
+ return props.resetKey === state.resetKey
254
+ ? null
255
+ : { error: null, resetKey: props.resetKey };
256
+ }
257
+
198
258
  render(): ReactNode {
199
259
  return this.state.error !== null
200
260
  ? this.props.fallback(this.state.error)
@@ -203,18 +263,34 @@ class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
203
263
  }
204
264
 
205
265
  // A plain boundary sticks in its error state after the user navigates away.
206
- // Key it by the location so navigation remounts it fresh:
266
+ // Reset it when the location changes. Do not key it by the location: a key
267
+ // remounts its whole subtree, kept wrappers included, on every navigation.
207
268
  function RouteErrorGate({ children }: { children: ReactNode }) {
208
269
  const { href } = useRoute();
209
270
 
210
271
  return (
211
- <ErrorBoundary key={href} fallback={(error) => <CrashPage error={error} />}>
272
+ <ErrorBoundary resetKey={href} fallback={(error) => <CrashPage error={error} />}>
212
273
  {children}
213
274
  </ErrorBoundary>
214
275
  );
215
276
  }
216
277
  ```
217
278
 
279
+ The same applies inside a wrapper. `Outlet` keeps a wrapper mounted while you move between routes that share it, so an error boundary or a mount effect placed in a wrapper no longer resets per route. Reset it on `href`, as `RouteErrorGate` does:
280
+
281
+ ```tsx
282
+ import type { WrapperComponentProps } from "@canonical/router-core";
283
+
284
+ function SectionLayout({ children }: WrapperComponentProps<ReactNode>) {
285
+ return (
286
+ <section>
287
+ <SectionNav />
288
+ <RouteErrorGate>{children}</RouteErrorGate>
289
+ </section>
290
+ );
291
+ }
292
+ ```
293
+
218
294
  Compose the two channels in one place — status gate outside, render boundary inside — and every route gets both behaviors for free.
219
295
 
220
296
  ## Search param mutation
@@ -427,7 +503,9 @@ hydrateRoot(
427
503
 
428
504
  ### `Outlet`
429
505
 
430
- `Outlet` subscribes to router state, builds the matched subtree with `createElement`, and wraps it in `Suspense`.
506
+ `Outlet` subscribes to router state, builds the matched subtree with `createElement`, and wraps each layer in its own `Suspense`: every wrapper keyed by its `id`, the route content keyed by the route name.
507
+
508
+ A wrapper stays mounted across a navigation, with its state, effects and DOM, when it sits at the same position in both routes' `wrappers` chains, with the same `id` (a router rejects two wrapper definitions that share an id, so the same id always means the same component), and every wrapper outside it does too. Any other wrapper remounts. The content remounts when the route name changes; a navigation within one route (new params or search) updates it in place. Something inside a kept wrapper that must reset per route, such as an error boundary, resets on `href` (see [Error handling](#error-handling)). A layer that suspends shows `fallback` in its place; the wrappers outside it stay rendered.
431
509
 
432
510
  It does **not** call `router.render()`. Core `render()` invokes the route's content and each wrapper as plain functions, which gives them no fiber of their own — every hook they declare would attach to `Outlet`'s hook list, and navigating between routes whose components declare different numbers of hooks would throw *"Rendered fewer hooks than expected"*. Constructing elements instead gives each component its own fiber, so its hooks belong to it. `render()` remains the correct shape for a non-React consumer.
433
511
 
@@ -463,7 +541,7 @@ The reference integration lives in [apps/react/boilerplate-vite](../../../apps/r
463
541
 
464
542
  - domain-colocated route modules assembled into one flat map
465
543
  - a shell-as-layout wrapper applied with `group()`
466
- - SSR with real HTTP statuses and redirects (`resolveRouteDisposition` in its server entry) and hydration via `readDehydratedState()`
544
+ - SSR with real HTTP statuses and redirects (`resolveRoute` and `warmRoute` in `src/server/renderPage.tsx`) and hydration from the embedded router state
467
545
  - a route-level `warm` hook priming the Relay store, read by the component's own query hook
468
546
  - an auth middleware redirect flow
469
547
  - a static redirect route answering 301
@@ -6,8 +6,18 @@ import useRouter from "../hooks/useRouter.js";
6
6
  *
7
7
  * `Outlet` subscribes to router state and only rerenders when the location
8
8
  * href changes — navigation-state transitions (`idle` → `loading`) do not
9
- * cause a rerender. The rendered content is keyed by route name so React
10
- * cleanly unmounts/remounts when the matched route changes.
9
+ * cause a rerender.
10
+ *
11
+ * Each layer sits in its own `Suspense` boundary showing `fallback`: every
12
+ * wrapper in a boundary keyed by its `id`, the route content in a boundary
13
+ * keyed by the route name. A wrapper therefore stays mounted, with its state
14
+ * and DOM, across a navigation when it sits at the same position in both
15
+ * routes' chains with the same `id` (the router allows one definition per
16
+ * id, so that is also the same component), and every wrapper outside it
17
+ * does too. Other wrappers remount; the content remounts
18
+ * when the route name changes.
19
+ * A layer that suspends shows `fallback` in its place while the layers
20
+ * around it stay rendered.
11
21
  *
12
22
  * Component-level render errors (e.g. a route's error component itself throws)
13
23
  * propagate past `Outlet`. Wrap it in a React `ErrorBoundary` to catch those.
@@ -46,11 +56,14 @@ export default function Outlet({ fallback = null }) {
46
56
  // `createElement` gives each component its own fiber, so its hooks belong
47
57
  // to it. Core's `render()` is left alone: it is the correct shape for a
48
58
  // non-React consumer, and this is a React-layer concern.
49
- let rendered = null;
59
+ let contentElement = null;
60
+ let wrappers = [];
50
61
  if (match && "route" in match && match.route.content) {
51
- const contentElement = createElement(match.route.content, { params: match.params, search: match.search });
52
- rendered = match.route.wrappers.reduceRight((children, currentWrapper) => createElement(currentWrapper.component, null, children), contentElement);
62
+ contentElement = createElement(match.route.content, { params: match.params, search: match.search });
63
+ wrappers = match.route.wrappers;
53
64
  }
54
- return (_jsx(Suspense, { fallback: fallback, children: rendered }, routeKey));
65
+ // Wrapper and content keys live in separate namespaces, so a wrapper whose
66
+ // id equals a route name never matches that route's content boundary.
67
+ return wrappers.reduceRight((children, currentWrapper) => (_jsx(Suspense, { fallback: fallback, children: createElement(currentWrapper.component, null, children) }, `wrapper:${currentWrapper.id}`)), _jsx(Suspense, { fallback: fallback, children: contentElement }, routeKey === undefined ? undefined : `route:${routeKey}`));
55
68
  }
56
69
  //# sourceMappingURL=Outlet.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Outlet.js","sourceRoot":"","sources":["../../../../src/lib/Outlet/Outlet.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,aAAa,EACb,QAAQ,EACR,WAAW,EACX,MAAM,EACN,oBAAoB,GACrB,MAAM,OAAO,CAAC;AACf,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAG9C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,QAAQ,GAAG,IAAI,EAAe;IAC7D,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxD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EACF,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAC/C,CAAC;QACF,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,QAA2B,CAAC;IACrD,CAAC;IAED,2EAA2E;IAC3E,sEAAsE;IACtE,OAAO,QAAQ,CAAC,WAAW,CACzB,CAAC,QAAQ,EAAE,cAAc,EAAE,EAAE,CAAC,CAC5B,KAAC,QAAQ,IAAsC,QAAQ,EAAE,QAAQ,YAC9D,aAAa,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,CAAC,IAD3C,WAAW,cAAc,CAAC,EAAE,EAAE,CAElC,CACZ,EACD,KAAC,QAAQ,IAEP,QAAQ,EAAE,QAAQ,YAEjB,cAAc,IAHV,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,QAAQ,EAAE,CAIpD,CACZ,CAAC;AACJ,CAAC"}
@@ -5,8 +5,18 @@ import type { OutletProps } from "./types.js";
5
5
  *
6
6
  * `Outlet` subscribes to router state and only rerenders when the location
7
7
  * href changes — navigation-state transitions (`idle` → `loading`) do not
8
- * cause a rerender. The rendered content is keyed by route name so React
9
- * cleanly unmounts/remounts when the matched route changes.
8
+ * cause a rerender.
9
+ *
10
+ * Each layer sits in its own `Suspense` boundary showing `fallback`: every
11
+ * wrapper in a boundary keyed by its `id`, the route content in a boundary
12
+ * keyed by the route name. A wrapper therefore stays mounted, with its state
13
+ * and DOM, across a navigation when it sits at the same position in both
14
+ * routes' chains with the same `id` (the router allows one definition per
15
+ * id, so that is also the same component), and every wrapper outside it
16
+ * does too. Other wrappers remount; the content remounts
17
+ * when the route name changes.
18
+ * A layer that suspends shows `fallback` in its place while the layers
19
+ * around it stay rendered.
10
20
  *
11
21
  * Component-level render errors (e.g. a route's error component itself throws)
12
22
  * propagate past `Outlet`. Wrap it in a React `ErrorBoundary` to catch those.
@@ -1 +1 @@
1
- {"version":3,"file":"Outlet.d.ts","sourceRoot":"","sources":["../../../../src/lib/Outlet/Outlet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,YAAY,EAAa,MAAM,OAAO,CAAC;AASpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,QAAe,EAAE,EAAE,WAAW,GAAG,YAAY,CAwE7E"}
1
+ {"version":3,"file":"Outlet.d.ts","sourceRoot":"","sources":["../../../../src/lib/Outlet/Outlet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,YAAY,EAAa,MAAM,OAAO,CAAC;AASpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,QAAe,EAAE,EAAE,WAAW,GAAG,YAAY,CA6E7E"}
@@ -9,15 +9,26 @@ import type { AnyRoute, RouteMap } from "@canonical/router-core";
9
9
  * declare module "@canonical/router-react" {
10
10
  * interface RouterRegister {
11
11
  * routes: typeof appRoutes;
12
+ * meta: AppRouteMeta;
12
13
  * }
13
14
  * }
14
15
  * ```
15
16
  *
16
17
  * When no registration exists the fallback is `RouteMap` (any string key),
17
- * which compiles but provides no autocomplete or typo detection.
18
+ * which compiles but provides no autocomplete or typo detection. A declared
19
+ * `meta` types every route's `meta` (see `RouteMeta` in
20
+ * `@canonical/router-core`), and a declared `context` types the value every
21
+ * `warm` receives (see `RouterContext`).
18
22
  */
19
23
  export interface RouterRegister {
20
24
  }
25
+ /** This package's register, under a name the core augmentation can extend. */
26
+ type ReactRouterRegister = RouterRegister;
27
+ declare module "@canonical/router-core" {
28
+ /** Merges `@canonical/router-react`'s register into the core one. */
29
+ interface RouterRegister extends ReactRouterRegister {
30
+ }
31
+ }
21
32
  /** Resolves to the registered route map, or falls back to `RouteMap`. */
22
33
  export type RegisteredRouteMap = RouterRegister extends {
23
34
  routes: infer T extends RouteMap;
@@ -26,4 +37,5 @@ export type RegisteredRouteMap = RouterRegister extends {
26
37
  export type RegisteredNotFound = RouterRegister extends {
27
38
  notFound: infer T extends AnyRoute | undefined;
28
39
  } ? T : undefined;
40
+ export {};
29
41
  //# sourceMappingURL=register.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/lib/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,cAAc;CAAG;AAElC,yEAAyE;AACzE,MAAM,MAAM,kBAAkB,GAAG,cAAc,SAAS;IACtD,MAAM,EAAE,MAAM,CAAC,SAAS,QAAQ,CAAC;CAClC,GACG,CAAC,GACD,QAAQ,CAAC;AAEb,gFAAgF;AAChF,MAAM,MAAM,kBAAkB,GAAG,cAAc,SAAS;IACtD,QAAQ,EAAE,MAAM,CAAC,SAAS,QAAQ,GAAG,SAAS,CAAC;CAChD,GACG,CAAC,GACD,SAAS,CAAC"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/lib/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,WAAW,cAAc;CAAG;AAElC,8EAA8E;AAC9E,KAAK,mBAAmB,GAAG,cAAc,CAAC;AAE1C,OAAO,QAAQ,wBAAwB,CAAC;IACtC,qEAAqE;IACrE,UAAU,cAAe,SAAQ,mBAAmB;KAAG;CACxD;AAED,yEAAyE;AACzE,MAAM,MAAM,kBAAkB,GAAG,cAAc,SAAS;IACtD,MAAM,EAAE,MAAM,CAAC,SAAS,QAAQ,CAAC;CAClC,GACG,CAAC,GACD,QAAQ,CAAC;AAEb,gFAAgF;AAChF,MAAM,MAAM,kBAAkB,GAAG,cAAc,SAAS;IACtD,QAAQ,EAAE,MAAM,CAAC,SAAS,QAAQ,GAAG,SAAS,CAAC;CAChD,GACG,CAAC,GACD,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@canonical/router-react",
3
3
  "description": "React bindings for @canonical/router-core",
4
- "version": "0.48.0",
4
+ "version": "0.50.0",
5
5
  "type": "module",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/types/index.d.ts",
@@ -44,16 +44,16 @@
44
44
  "test:coverage": "vitest run --coverage"
45
45
  },
46
46
  "dependencies": {
47
- "@canonical/react-ssr": "^0.48.0",
48
- "@canonical/router-core": "^0.48.0",
47
+ "@canonical/react-ssr": "^0.50.0",
48
+ "@canonical/router-core": "^0.50.0",
49
49
  "react": "^19.2.4",
50
50
  "react-dom": "^19.2.4"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@biomejs/biome": "2.6.9",
54
54
  "@canonical/biome-config": "0.47.0",
55
- "@canonical/typescript-config-react": "^0.48.0",
56
- "@canonical/vitest-config-react": "^0.48.0",
55
+ "@canonical/typescript-config-react": "^0.50.0",
56
+ "@canonical/vitest-config-react": "^0.50.0",
57
57
  "@canonical/webarchitect": "0.46.0",
58
58
  "@testing-library/jest-dom": "^7.0.0",
59
59
  "@testing-library/react": "^16.3.2",
@@ -67,5 +67,5 @@
67
67
  "vite": "^8.0.1",
68
68
  "vitest": "^5.0.0"
69
69
  },
70
- "gitHead": "aee4aebab851f90159776a7ba658d0c62e0d2bf4"
70
+ "gitHead": "4a2ca02b4767a0ee8e58a679281194fdc316fd71"
71
71
  }