@real-router/svelte 0.13.10 → 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 |
@@ -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.10",
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,7 +48,7 @@
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
53
  "@real-router/sources": "^0.10.0"
54
54
  },