@real-router/svelte 0.13.9 → 0.13.11

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
@@ -181,7 +181,7 @@ Navigation link with automatic active state detection. Uses `$derived` for href
181
181
  | Prop | Type | Default | Description |
182
182
  | ------------------- | ------------------- | ----------- | --------------------------------------- |
183
183
  | `routeName` | `string` | required | Target route name |
184
- | `routeParams` | `Params` | `{}` | Route parameters |
184
+ | `routeParams` | `Params` | `undefined` | Route parameters (omitted → `undefined`, shares one active-route source with `useIsActiveRoute(name)`, #776) |
185
185
  | `routeOptions` | `NavigationOptions` | `{}` | Navigation options (replace, etc.) |
186
186
  | `class` | `string` | `undefined` | CSS class |
187
187
  | `activeClassName` | `string` | `"active"` | Class added when route is active |
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { getNavigator } from "@real-router/core";
3
- import { createRouteSource } from "@real-router/sources";
3
+ import { createRouteSource, primeErrorSource } from "@real-router/sources";
4
4
  import {
5
5
  createRouteAnnouncer,
6
6
  createScrollRestoration,
@@ -105,6 +105,13 @@
105
105
  // svelte-ignore state_referenced_locally
106
106
  // The route source intentionally captures the initial router instance.
107
107
  const source = createRouteSource(router);
108
+ // #778 P2: eagerly create the per-router error source so a navigation error
109
+ // that fires BEFORE a RouterErrorBoundary mounts (a lazy app shell, a failed
110
+ // boot navigation) is still captured. The boundary's createDismissableError
111
+ // reuses this cached source and catches up (#765); without it the error source
112
+ // is created lazily on boundary mount — after the error — and never sees it.
113
+ // svelte-ignore state_referenced_locally
114
+ primeErrorSource(router);
108
115
  const reactive = createReactiveSource(source);
109
116
  const routeContext = createRouteContext(navigator, reactive);
110
117
 
@@ -14,7 +14,7 @@
14
14
 
15
15
  let {
16
16
  routeName,
17
- routeParams = EMPTY_PARAMS,
17
+ routeParams,
18
18
  routeOptions = EMPTY_OPTIONS,
19
19
  class: className = undefined,
20
20
  activeClassName = "active",
@@ -47,6 +47,13 @@
47
47
  } = $props();
48
48
 
49
49
  const router = useRouter();
50
+ // Pass `routeParams` straight through (possibly `undefined`) — do NOT default
51
+ // to EMPTY_PARAMS before the active-route call. `createActiveRouteSource` keys
52
+ // `params === undefined` as "" but EMPTY_PARAMS ({}) as "{}", so a no-params
53
+ // `<Link>` and a manual `useIsActiveRoute(routeName)` only share ONE cached
54
+ // source (one router subscription) when both pass `undefined`; defaulting here
55
+ // would split the same question into a second eager subscription (#776).
56
+ //
50
57
  // Hash-aware active (#532): tab links sharing routeName but differing in
51
58
  // hash should only light up the matching variant.
52
59
  // svelte-ignore state_referenced_locally
@@ -59,11 +66,12 @@
59
66
  hash,
60
67
  );
61
68
 
69
+ // Navigation/href building need a concrete params object — default here only.
62
70
  const href = $derived(
63
71
  buildHref(
64
72
  router,
65
73
  routeName,
66
- routeParams,
74
+ routeParams ?? EMPTY_PARAMS,
67
75
  hash !== undefined ? { hash } : undefined,
68
76
  ),
69
77
  );
@@ -86,9 +94,13 @@
86
94
  }
87
95
 
88
96
  evt.preventDefault();
89
- navigateWithHash(router, routeName, routeParams, hash, routeOptions).catch(
90
- NOOP,
91
- );
97
+ navigateWithHash(
98
+ router,
99
+ routeName,
100
+ routeParams ?? EMPTY_PARAMS,
101
+ hash,
102
+ routeOptions,
103
+ ).catch(NOOP);
92
104
  }
93
105
  </script>
94
106
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@real-router/svelte",
3
- "version": "0.13.9",
3
+ "version": "0.13.11",
4
4
  "type": "module",
5
5
  "description": "Svelte 5 integration for Real-Router",
6
6
  "svelte": "./dist/index.js",
@@ -48,9 +48,9 @@
48
48
  "license": "MIT",
49
49
  "sideEffects": false,
50
50
  "dependencies": {
51
- "@real-router/core": "^0.61.12",
51
+ "@real-router/core": "^0.61.13",
52
52
  "@real-router/route-utils": "^0.2.4",
53
- "@real-router/sources": "^0.9.0"
53
+ "@real-router/sources": "^0.10.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@sveltejs/package": "2.5.8",