@rangojs/router 0.35.0 → 0.36.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.
@@ -629,6 +629,7 @@ import {
629
629
  useCallback as useCallback5,
630
630
  useContext as useContext16,
631
631
  useEffect as useEffect13,
632
+ useId,
632
633
  useMemo as useMemo8,
633
634
  useRef as useRef10
634
635
  } from "react";
@@ -640,9 +641,7 @@ import {
640
641
  useState as useState9,
641
642
  useEffect as useEffect12
642
643
  } from "react";
643
- var LinkContext = createContext7(
644
- null
645
- );
644
+ var LinkContext = createContext7(null);
646
645
 
647
646
  // src/browser/prefetch/default-strategy.ts
648
647
  var ENVIRONMENT_DEFAULT_PREFETCH = process.env.NODE_ENV === "production" ? "viewport" : "none";
@@ -841,6 +840,11 @@ var Link = forwardRef(function Link2({
841
840
  () => isExternal ? to : prefixBasename(to, ctx?.basename),
842
841
  [to, isExternal, ctx?.basename]
843
842
  );
843
+ const linkId = useId();
844
+ const linkTarget = useMemo8(
845
+ () => ({ to: resolvedTo, id: linkId }),
846
+ [resolvedTo, linkId]
847
+ );
844
848
  const configuredStrategy = prefetch ?? ctx?.defaultPrefetch ?? ENVIRONMENT_DEFAULT_PREFETCH;
845
849
  const internalRef = useRef10(null);
846
850
  const setRef = useCallback5(
@@ -882,11 +886,13 @@ var Link = forwardRef(function Link2({
882
886
  scroll,
883
887
  state: state2,
884
888
  revalidate: revalidate3,
885
- transition: transition3
889
+ transition: transition3,
890
+ _linkId: linkId
886
891
  });
887
892
  },
888
893
  [
889
894
  resolvedTo,
895
+ linkId,
890
896
  isExternal,
891
897
  reloadDocument,
892
898
  replace,
@@ -998,7 +1004,7 @@ var Link = forwardRef(function Link2({
998
1004
  "data-revalidate": revalidate3 === false ? "false" : void 0,
999
1005
  "data-transition": transition3 === false ? "false" : void 0,
1000
1006
  ...props,
1001
- children: /* @__PURE__ */ jsx8(LinkContext.Provider, { value: resolvedTo, children })
1007
+ children: /* @__PURE__ */ jsx8(LinkContext.Provider, { value: linkTarget, children })
1002
1008
  }
1003
1009
  );
1004
1010
  });
@@ -10,7 +10,7 @@ import {
10
10
  refreshRecordedClientUrlProjections,
11
11
  resolveClientUrlsSource,
12
12
  scanForClientUrlModules
13
- } from "./chunk-3CQXDX3A.js";
13
+ } from "./chunk-THW7E5A2.js";
14
14
  import "./chunk-MWOHBDPM.js";
15
15
  import "./chunk-LD7UBHT4.js";
16
16
  export {
package/dist/bin/rango.js CHANGED
@@ -229,7 +229,7 @@ ${formatNestedRouterConflictError(nestedRouterConflict, "[rango]")}
229
229
  }
230
230
  let discoverAndWriteRouteTypes;
231
231
  try {
232
- const mod = await import("./runtime-discovery-PA3V3IFQ.js");
232
+ const mod = await import("./runtime-discovery-UECTPF6K.js");
233
233
  discoverAndWriteRouteTypes = mod.discoverAndWriteRouteTypes;
234
234
  } catch (err) {
235
235
  if (err.code === "ERR_MODULE_NOT_FOUND" || err.code === "MODULE_NOT_FOUND") {
@@ -163,9 +163,9 @@ async function discoverAndWriteRouteTypes(opts) {
163
163
  "Runtime discovery requires '@vitejs/plugin-rsc'. Install it with: pnpm add -D @vitejs/plugin-rsc"
164
164
  );
165
165
  }
166
- const { createTempRscServer } = await import("./temp-rsc-server-WDXEHDY7.js");
166
+ const { createTempRscServer } = await import("./temp-rsc-server-QLNMTFEE.js");
167
167
  const { createDiscoveryState } = await import("./state-ACD2MGKJ.js");
168
- const { discoverClientUrlProjections } = await import("./client-urls-projection-2GBDM5YK.js");
168
+ const { discoverClientUrlProjections } = await import("./client-urls-projection-DHUUOJZM.js");
169
169
  const {
170
170
  isFrameworkPlugin,
171
171
  pickForwardedRunnerConfig,
@@ -27,7 +27,7 @@ import {
27
27
  propertyKeyIs,
28
28
  recordClientUrlsModule,
29
29
  unwrapExpression
30
- } from "./chunk-3CQXDX3A.js";
30
+ } from "./chunk-THW7E5A2.js";
31
31
  import "./chunk-MWOHBDPM.js";
32
32
  import {
33
33
  codeMatchIndices,
@@ -47,7 +47,7 @@ var DEFAULT_ROUTER_VERSIONS_KEY = "*";
47
47
  // package.json
48
48
  var package_default = {
49
49
  name: "@rangojs/router",
50
- version: "0.35.0",
50
+ version: "0.36.0",
51
51
  description: "Django-inspired RSC router with composable URL patterns",
52
52
  keywords: [
53
53
  "react",
@@ -1,9 +1,17 @@
1
1
  import { type Context } from "react";
2
2
  /**
3
- * Context for Link component to provide its destination URL
4
- * Used by useLinkStatus to determine if this specific link is pending
3
+ * What a Link hands to useLinkStatus: its resolved destination and an id for
4
+ * this Link instance, which its click puts on the navigation (`_linkId`).
5
5
  */
6
- export declare const LinkContext: Context<string | null>;
6
+ export interface LinkTarget {
7
+ readonly to: string;
8
+ readonly id: string;
9
+ }
10
+ /**
11
+ * Context for Link component to provide its destination and instance id.
12
+ * Used by useLinkStatus to determine if this specific link is pending.
13
+ */
14
+ export declare const LinkContext: Context<LinkTarget | null>;
7
15
  /**
8
16
  * Link status returned by useLinkStatus hook
9
17
  */
@@ -14,11 +22,12 @@ export interface LinkStatus {
14
22
  /**
15
23
  * Hook to track the pending state of a Link component
16
24
  *
17
- * Must be used inside a Link component. Returns `{ pending: true }` while a
18
- * navigation to the link's destination is in flight, until the page it
19
- * brings commits: under transition() while React holds that page, and
20
- * through a server redirect until the target page commits. A newer
21
- * navigation ends it at once.
25
+ * Must be used inside a Link component. Returns `{ pending: true }` while
26
+ * this link's navigation is in flight, until the page it brings commits:
27
+ * under transition() while React holds that page, and through a server
28
+ * redirect until the target page commits. A click marks only the clicked
29
+ * link; a navigation no link started (Back/Forward, router.push) marks every
30
+ * link to its URL. A newer navigation ends it at once.
22
31
  *
23
32
  * Useful for showing inline loading indicators on individual links.
24
33
  *
@@ -469,6 +469,8 @@ export interface NavigateOptionsInternal extends Omit<NavigateOptions, "state">
469
469
  _redirectHops?: number;
470
470
  /** The URL a redirected navigation chain started from: a link to it stays pending (useLinkStatus) */
471
471
  _redirectFrom?: string;
472
+ /** The Link instance whose click started this navigation chain: only that link is pending (useLinkStatus) */
473
+ _linkId?: string;
472
474
  }
473
475
  /**
474
476
  * Options for useRouter push/replace methods.
@@ -25,8 +25,9 @@
25
25
  * This exercises the context read path, not the run path.
26
26
  * - navigate() drives the navigation lifecycle as a click does:
27
27
  * useNavigation() reads loading from the call and idle with the commit,
28
- * and useLinkStatus().pending is true for a link to the destination until
29
- * the commit, which React holds with it. A `transition` spec plus a pending
28
+ * and useLinkStatus().pending is true for every link to the destination
29
+ * (for a <Link> click, the clicked link only) until the commit, which
30
+ * React holds with it. A `transition` spec plus a pending
30
31
  * Promise seeded via navigate(url, { loaders }) commits through
31
32
  * production's commitInTransition (browser/partial-update.ts), which React
32
33
  * holds: useNavigation() stays loading and the held reader's
@@ -5510,6 +5510,7 @@ import {
5510
5510
  useCallback as useCallback5,
5511
5511
  useContext as useContext16,
5512
5512
  useEffect as useEffect13,
5513
+ useId,
5513
5514
  useMemo as useMemo8,
5514
5515
  useRef as useRef10
5515
5516
  } from "react";
@@ -5521,9 +5522,7 @@ import {
5521
5522
  useState as useState9,
5522
5523
  useEffect as useEffect12
5523
5524
  } from "react";
5524
- var LinkContext = createContext7(
5525
- null
5526
- );
5525
+ var LinkContext = createContext7(null);
5527
5526
 
5528
5527
  // src/browser/prefetch/default-strategy.ts
5529
5528
  var ENVIRONMENT_DEFAULT_PREFETCH = process.env.NODE_ENV === "production" ? "viewport" : "none";
@@ -5726,6 +5725,11 @@ var Link = forwardRef(function Link2({
5726
5725
  () => isExternal ? to : prefixBasename(to, ctx?.basename),
5727
5726
  [to, isExternal, ctx?.basename]
5728
5727
  );
5728
+ const linkId = useId();
5729
+ const linkTarget2 = useMemo8(
5730
+ () => ({ to: resolvedTo, id: linkId }),
5731
+ [resolvedTo, linkId]
5732
+ );
5729
5733
  const configuredStrategy = prefetch ?? ctx?.defaultPrefetch ?? ENVIRONMENT_DEFAULT_PREFETCH;
5730
5734
  const internalRef = useRef10(null);
5731
5735
  const setRef = useCallback5(
@@ -5767,11 +5771,13 @@ var Link = forwardRef(function Link2({
5767
5771
  scroll,
5768
5772
  state: state2,
5769
5773
  revalidate: revalidate3,
5770
- transition: transition3
5774
+ transition: transition3,
5775
+ _linkId: linkId
5771
5776
  });
5772
5777
  },
5773
5778
  [
5774
5779
  resolvedTo,
5780
+ linkId,
5775
5781
  isExternal,
5776
5782
  reloadDocument,
5777
5783
  replace,
@@ -5883,7 +5889,7 @@ var Link = forwardRef(function Link2({
5883
5889
  "data-revalidate": revalidate3 === false ? "false" : void 0,
5884
5890
  "data-transition": transition3 === false ? "false" : void 0,
5885
5891
  ...props,
5886
- children: /* @__PURE__ */ jsx8(LinkContext.Provider, { value: resolvedTo, children })
5892
+ children: /* @__PURE__ */ jsx8(LinkContext.Provider, { value: linkTarget2, children })
5887
5893
  }
5888
5894
  );
5889
5895
  });
@@ -7344,7 +7350,7 @@ function resolveVersionsFrom(table, routerId2) {
7344
7350
  // package.json
7345
7351
  var package_default = {
7346
7352
  name: "@rangojs/router",
7347
- version: "0.35.0",
7353
+ version: "0.36.0",
7348
7354
  description: "Django-inspired RSC router with composable URL patterns",
7349
7355
  keywords: [
7350
7356
  "react",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rangojs/router",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "Django-inspired RSC router with composable URL patterns",
5
5
  "keywords": [
6
6
  "react",
@@ -262,9 +262,8 @@ after its commit, as handle values do (see
262
262
 
263
263
  ### useLinkStatus()
264
264
 
265
- Track pending state inside a Link component. `pending` is `true` while a
266
- navigation to the link's `to` is in flight, until the page it brings
267
- commits:
265
+ Track pending state inside a Link component. `pending` is `true` while this
266
+ link's navigation is in flight, until the page it brings commits:
268
267
 
269
268
  ```tsx
270
269
  "use client";
@@ -282,6 +281,14 @@ function LoadingIndicator() {
282
281
  </Link>;
283
282
  ```
284
283
 
284
+ A click marks the link that was clicked: with two links to the same `to` on
285
+ the page, only the clicked one reads `pending`, and a click on the other moves
286
+ it there. A navigation no link started (Back/Forward, `router.push()` or
287
+ `replace()`, a form post, an action's redirect) marks every link to its URL.
288
+ The mark belongs to the `<Link>` instance: a link that remounts while its
289
+ navigation is in flight (a new `key`, a parent of another type) is a new link
290
+ and reads `false`, so keep it mounted where a spinner should stay.
291
+
285
292
  The spinner ends in the commit that shows the destination: its `loading()`
286
293
  skeleton without `transition()`, or the page itself under `transition()`,
287
294
  where React holds the page being left until the new one is ready. Through a
@@ -450,7 +450,7 @@ it("dims the held price while the next product streams", async () => {
450
450
  | navigate() without `transition`, pending seed | Urgent commit (production's cold-navigation lane): the read suspends to the nearest `<Suspense>` fallback (with none, React keeps the previous tree). No flag. |
451
451
  | `transition: { when }` returning false, or `navigate(url, { transition: false })` | Same as without `transition`: urgent, with production's decision (`kind: "push"`; `refresh()` is `"revalidate"`). `transition: false` calls no predicate. |
452
452
  | Production's other hold lanes (same-structure search/filter nav, fully-prefetched, optimistic) | NOT modeled — without `transition` navigate() stays urgent. Assert those at e2e. |
453
- | `useNavigation().state`, `useLinkStatus().pending` | Modeled: navigate() starts the navigation as a click does. `loading` from the call, `idle` in the commit, held with it; `pending` true for the destination's link until that commit, held with it too. |
453
+ | `useNavigation().state`, `useLinkStatus().pending` | Modeled: navigate() starts the navigation as a click does. `loading` from the call, `idle` in the commit, held with it; `pending` true for the destination's links until that commit, held with it too; a `<Link>` click marks that link only. |
454
454
  | `useAction().state` | Stays `idle`: navigate() runs no action. e2e. |
455
455
  | `useHandle()` on a held navigation, `navigate(url, { handles, loaders })` | Modeled: `handles` arrive on the response's handle stream, so readers keep the page being left's values while React holds the page and take the new ones with its commit. |
456
456
  | `useNavigation().isStreaming` past the commit, `navigate(url, { streamUntil })` | Modeled: the stream opens a task after the call (`pendingUrl` clears) and ends when the promise settles or a newer navigation aborts it; settle it inside `await act(async () => ...)`. |
@@ -285,7 +285,7 @@ export function createNavigationBridge(
285
285
  hops: number,
286
286
  options: Pick<
287
287
  NavigateOptionsInternal,
288
- "replace" | "transition" | "_redirectFrom"
288
+ "replace" | "transition" | "_redirectFrom" | "_linkId"
289
289
  >,
290
290
  ): Promise<void> {
291
291
  const redirectUrl = validateRedirectOrigin(
@@ -715,6 +715,7 @@ export function createNavigationBridge(
715
715
  replace: options?.replace,
716
716
  transition: options?.transition,
717
717
  _redirectFrom: options?._redirectFrom,
718
+ _linkId: options?._linkId,
718
719
  },
719
720
  );
720
721
  }
@@ -5,13 +5,14 @@ import React, {
5
5
  useCallback,
6
6
  useContext,
7
7
  useEffect,
8
+ useId,
8
9
  useMemo,
9
10
  useRef,
10
11
  type ForwardRefExoticComponent,
11
12
  type RefAttributes,
12
13
  } from "react";
13
14
  import { NavigationStoreContext } from "./context.js";
14
- import { LinkContext } from "./use-link-status.js";
15
+ import { LinkContext, type LinkTarget } from "./use-link-status.js";
15
16
  import type { HistoryState } from "../types.js";
16
17
  import {
17
18
  isHashOnlyNavigation,
@@ -258,6 +259,14 @@ export const Link: ForwardRefExoticComponent<
258
259
  [to, isExternal, ctx?.basename],
259
260
  );
260
261
 
262
+ // This instance's id: its click names it on the navigation, so
263
+ // useLinkStatus marks this link and not every link to the same URL.
264
+ const linkId = useId();
265
+ const linkTarget = useMemo<LinkTarget>(
266
+ () => ({ to: resolvedTo, id: linkId }),
267
+ [resolvedTo, linkId],
268
+ );
269
+
261
270
  // No explicit `prefetch` prop: fall back to the router-wide default from
262
271
  // the router store. Adaptive is resolved against the input capability when a
263
272
  // prefetch is armed or triggered, never during render.
@@ -344,10 +353,12 @@ export const Link: ForwardRefExoticComponent<
344
353
  state,
345
354
  revalidate,
346
355
  transition,
356
+ _linkId: linkId,
347
357
  });
348
358
  },
349
359
  [
350
360
  resolvedTo,
361
+ linkId,
351
362
  isExternal,
352
363
  reloadDocument,
353
364
  replace,
@@ -494,7 +505,7 @@ export const Link: ForwardRefExoticComponent<
494
505
  data-transition={transition === false ? "false" : undefined}
495
506
  {...props}
496
507
  >
497
- <LinkContext.Provider value={resolvedTo}>{children}</LinkContext.Provider>
508
+ <LinkContext.Provider value={linkTarget}>{children}</LinkContext.Provider>
498
509
  </a>
499
510
  );
500
511
  });
@@ -11,12 +11,20 @@ import { NavigationStoreContext } from "./context.js";
11
11
  import type { EventController, NavigationEntry } from "../event-controller.js";
12
12
 
13
13
  /**
14
- * Context for Link component to provide its destination URL
15
- * Used by useLinkStatus to determine if this specific link is pending
14
+ * What a Link hands to useLinkStatus: its resolved destination and an id for
15
+ * this Link instance, which its click puts on the navigation (`_linkId`).
16
16
  */
17
- export const LinkContext: Context<string | null> = createContext<string | null>(
18
- null,
19
- );
17
+ export interface LinkTarget {
18
+ readonly to: string;
19
+ readonly id: string;
20
+ }
21
+
22
+ /**
23
+ * Context for Link component to provide its destination and instance id.
24
+ * Used by useLinkStatus to determine if this specific link is pending.
25
+ */
26
+ export const LinkContext: Context<LinkTarget | null> =
27
+ createContext<LinkTarget | null>(null);
20
28
 
21
29
  /**
22
30
  * Link status returned by useLinkStatus hook
@@ -53,18 +61,25 @@ function visibleNavigation(ec: EventController): NavigationEntry | null {
53
61
  }
54
62
 
55
63
  /**
56
- * Whether `navigation` goes to `linkTo`: its URL or, after a server redirect,
57
- * the URL its chain started from.
64
+ * Whether `navigation` is this link's. A Link's click names the link
65
+ * (`_linkId`, kept through a server redirect chain), so only that link is
66
+ * pending, not every link to the same URL. A navigation no Link started
67
+ * (Back/Forward, router.push, an action's redirect) goes to every link to its
68
+ * URL or, after a server redirect, to the URL its chain started from.
58
69
  */
59
70
  function isPendingFor(
60
- linkTo: string | null,
71
+ link: LinkTarget | null,
61
72
  navigation: NavigationEntry | null,
62
73
  origin: string,
63
74
  ): boolean {
64
- if (linkTo === null || !navigation) {
75
+ if (link === null || !navigation) {
65
76
  return false;
66
77
  }
67
- const to = normalizeUrl(linkTo, origin);
78
+ const linkId = navigation.options?._linkId;
79
+ if (linkId !== undefined) {
80
+ return linkId === link.id;
81
+ }
82
+ const to = normalizeUrl(link.to, origin);
68
83
  const from = navigation.options?._redirectFrom;
69
84
  return (
70
85
  normalizeUrl(navigation.url, origin) === to ||
@@ -75,11 +90,12 @@ function isPendingFor(
75
90
  /**
76
91
  * Hook to track the pending state of a Link component
77
92
  *
78
- * Must be used inside a Link component. Returns `{ pending: true }` while a
79
- * navigation to the link's destination is in flight, until the page it
80
- * brings commits: under transition() while React holds that page, and
81
- * through a server redirect until the target page commits. A newer
82
- * navigation ends it at once.
93
+ * Must be used inside a Link component. Returns `{ pending: true }` while
94
+ * this link's navigation is in flight, until the page it brings commits:
95
+ * under transition() while React holds that page, and through a server
96
+ * redirect until the target page commits. A click marks only the clicked
97
+ * link; a navigation no link started (Back/Forward, router.push) marks every
98
+ * link to its URL. A newer navigation ends it at once.
83
99
  *
84
100
  * Useful for showing inline loading indicators on individual links.
85
101
  *
@@ -98,7 +114,7 @@ function isPendingFor(
98
114
  * ```
99
115
  */
100
116
  export function useLinkStatus(): LinkStatus {
101
- const linkTo = useContext(LinkContext);
117
+ const link = useContext(LinkContext);
102
118
  const ctx = useContext(NavigationStoreContext);
103
119
 
104
120
  const origin = ctx?.origin ?? "http://localhost";
@@ -108,7 +124,7 @@ export function useLinkStatus(): LinkStatus {
108
124
  () =>
109
125
  !!ctx &&
110
126
  !ctx.eventController.getHydrationSnapshot() &&
111
- isPendingFor(linkTo, visibleNavigation(ctx.eventController), origin),
127
+ isPendingFor(link, visibleNavigation(ctx.eventController), origin),
112
128
  );
113
129
 
114
130
  // The value commits in the lane of the notification that carries it, as
@@ -117,9 +133,11 @@ export function useLinkStatus(): LinkStatus {
117
133
  // notification inside the page's update). Set once per navigation: a
118
134
  // repeated urgent set would commit ahead of a held page's settle. A
119
135
  // background navigation (an action's refetch) is not a newer one, so a
120
- // held link stays pending.
136
+ // held link stays pending. Deps are the link's fields, not the object: a
137
+ // provider's new object with the same fields must not resubscribe and set
138
+ // the value again.
121
139
  useEffect(() => {
122
- if (!ctx || linkTo === null) {
140
+ if (!ctx || link === null) {
123
141
  return;
124
142
  }
125
143
 
@@ -128,7 +146,7 @@ export function useLinkStatus(): LinkStatus {
128
146
  const navigation = visibleNavigation(ctx.eventController);
129
147
  if (navigation === last) return;
130
148
  last = navigation;
131
- setPending(isPendingFor(linkTo, navigation, origin));
149
+ setPending(isPendingFor(link, navigation, origin));
132
150
  };
133
151
 
134
152
  // Catch-up: re-read state synchronously on mount before subscribing, so a
@@ -138,10 +156,10 @@ export function useLinkStatus(): LinkStatus {
138
156
  update();
139
157
 
140
158
  return ctx.eventController.subscribe(update);
141
- }, [linkTo, origin]);
159
+ }, [link?.to, link?.id, origin]);
142
160
 
143
161
  // If not inside a Link, return not pending
144
- if (linkTo === null) {
162
+ if (link === null) {
145
163
  return { pending: false };
146
164
  }
147
165
 
@@ -525,6 +525,8 @@ export interface NavigateOptionsInternal extends Omit<
525
525
  _redirectHops?: number;
526
526
  /** The URL a redirected navigation chain started from: a link to it stays pending (useLinkStatus) */
527
527
  _redirectFrom?: string;
528
+ /** The Link instance whose click started this navigation chain: only that link is pending (useLinkStatus) */
529
+ _linkId?: string;
528
530
  }
529
531
 
530
532
  /**
@@ -25,8 +25,9 @@
25
25
  * This exercises the context read path, not the run path.
26
26
  * - navigate() drives the navigation lifecycle as a click does:
27
27
  * useNavigation() reads loading from the call and idle with the commit,
28
- * and useLinkStatus().pending is true for a link to the destination until
29
- * the commit, which React holds with it. A `transition` spec plus a pending
28
+ * and useLinkStatus().pending is true for every link to the destination
29
+ * (for a <Link> click, the clicked link only) until the commit, which
30
+ * React holds with it. A `transition` spec plus a pending
30
31
  * Promise seeded via navigate(url, { loaders }) commits through
31
32
  * production's commitInTransition (browser/partial-update.ts), which React
32
33
  * holds: useNavigation() stays loading and the held reader's
@@ -1057,6 +1058,8 @@ export async function renderRoute(
1057
1058
  /** The loader data the response carries: a prefetch's (prefetch()). */
1058
1059
  seeds?: Record<string, unknown>;
1059
1060
  history?: Pick<NavigateOptionsInternal, "state" | "replace" | "transition">;
1061
+ /** A <Link> click: the clicked instance, as production's entry carries it. */
1062
+ linkId?: string;
1060
1063
  kind?: TransitionWhenKind;
1061
1064
  transition?: boolean;
1062
1065
  streamUntil?: Promise<unknown>;
@@ -1152,6 +1155,9 @@ export async function renderRoute(
1152
1155
  }
1153
1156
  const handle = eventController.startNavigation(
1154
1157
  new URL(target, TEST_ORIGIN).href,
1158
+ navOptions?.linkId === undefined
1159
+ ? undefined
1160
+ : { _linkId: navOptions.linkId },
1155
1161
  );
1156
1162
  // An action made the prefetch stale: once this navigation settled (its
1157
1163
  // commit and its stream), the page revalidates. Production's own guards
@@ -1546,7 +1552,10 @@ export async function renderRoute(
1546
1552
  let prefetchRoot: HTMLElement | undefined;
1547
1553
  const bridge: NavigationBridge = {
1548
1554
  navigate: (target, navigateOptions) =>
1549
- navigate(target, { history: navigateOptions ?? {} }),
1555
+ navigate(target, {
1556
+ history: navigateOptions ?? {},
1557
+ linkId: navigateOptions?._linkId,
1558
+ }),
1550
1559
  refresh: () => refresh(),
1551
1560
  // Back/forward onto the entry history.state holds. Its page is restored
1552
1561
  // when the mount or a navigation wrote the entry, history still holds that