react-router 7.17.0 → 7.18.1

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 (80) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/dist/development/{browser-D3uq9sI1.d.ts → browser-B2PdsXXH.d.ts} +2 -2
  3. package/dist/development/{browser-CGcs-0pD.d.mts → browser-DBmQ1yAR.d.mts} +2 -2
  4. package/dist/development/{chunk-PBLBZ3QU.js → chunk-EVX4J2F5.js} +7 -7
  5. package/dist/development/{chunk-PULC7NLK.js → chunk-G5KIBF6U.js} +111 -108
  6. package/dist/{production/chunk-5TQZEVD5.mjs → development/chunk-IJF3QNGC.mjs} +45 -113
  7. package/dist/development/{chunk-6CSD65Y2.mjs → chunk-KS7C4IRE.mjs} +115 -38
  8. package/dist/development/{chunk-KFNXW4AL.js → chunk-SA4DP3SF.js} +113 -35
  9. package/dist/{production/context-CmHpk1Ws.d.mts → development/context-CeD5LmaF.d.mts} +12 -4
  10. package/dist/{production/data-D4xhSy90.d.ts → development/data-CjO11-hU.d.ts} +9 -1
  11. package/dist/development/{data-U8FS-wNn.d.mts → data-DEjBmEfD.d.mts} +9 -1
  12. package/dist/development/dom-export.d.mts +3 -3
  13. package/dist/development/dom-export.d.ts +3 -3
  14. package/dist/development/dom-export.js +46 -44
  15. package/dist/development/dom-export.mjs +23 -21
  16. package/dist/development/{index-react-server-client-CwU9bE5R.d.ts → index-react-server-client-3ykjivgQ.d.ts} +29 -7
  17. package/dist/development/{index-react-server-client-DPrDrCew.d.mts → index-react-server-client-CACgcj2J.d.mts} +19 -5
  18. package/dist/development/index-react-server-client.d.mts +3 -3
  19. package/dist/development/index-react-server-client.d.ts +3 -3
  20. package/dist/development/index-react-server-client.js +4 -4
  21. package/dist/development/index-react-server-client.mjs +2 -2
  22. package/dist/development/index-react-server.d.mts +9 -1
  23. package/dist/development/index-react-server.d.ts +9 -1
  24. package/dist/development/index-react-server.js +144 -121
  25. package/dist/development/index-react-server.mjs +143 -120
  26. package/dist/development/index.d.mts +15 -14
  27. package/dist/development/index.d.ts +15 -14
  28. package/dist/development/index.js +137 -205
  29. package/dist/development/index.mjs +3 -5
  30. package/dist/{production/instrumentation-1q4YhLGP.d.ts → development/instrumentation-Dkmpzd13.d.ts} +2 -2
  31. package/dist/development/lib/types/internal.d.mts +2 -2
  32. package/dist/development/lib/types/internal.d.ts +2 -2
  33. package/dist/development/lib/types/internal.js +1 -1
  34. package/dist/development/lib/types/internal.mjs +1 -1
  35. package/dist/development/{register-CqK96Zfk.d.mts → register-CmkRspdl.d.mts} +1 -1
  36. package/dist/development/{register-CNAx3TXj.d.ts → register-roq_0qYo.d.ts} +1 -1
  37. package/dist/production/{browser-D3uq9sI1.d.ts → browser-B2PdsXXH.d.ts} +2 -2
  38. package/dist/production/{browser-CGcs-0pD.d.mts → browser-DBmQ1yAR.d.mts} +2 -2
  39. package/dist/{development/chunk-ASILSGTR.mjs → production/chunk-3MA7PLKB.mjs} +45 -113
  40. package/dist/production/{chunk-OSYEOCBT.mjs → chunk-3WDNQUW5.mjs} +115 -38
  41. package/dist/production/{chunk-CTIXC7EV.js → chunk-GOIER6ML.js} +7 -7
  42. package/dist/production/{chunk-RTRY3JFT.js → chunk-IEF7VMTA.js} +113 -35
  43. package/dist/production/{chunk-EN242BO4.js → chunk-WICLSFKL.js} +111 -108
  44. package/dist/{development/context-CmHpk1Ws.d.mts → production/context-CeD5LmaF.d.mts} +12 -4
  45. package/dist/{development/data-D4xhSy90.d.ts → production/data-CjO11-hU.d.ts} +9 -1
  46. package/dist/production/{data-U8FS-wNn.d.mts → data-DEjBmEfD.d.mts} +9 -1
  47. package/dist/production/dom-export.d.mts +3 -3
  48. package/dist/production/dom-export.d.ts +3 -3
  49. package/dist/production/dom-export.js +46 -44
  50. package/dist/production/dom-export.mjs +23 -21
  51. package/dist/production/{index-react-server-client-CwU9bE5R.d.ts → index-react-server-client-3ykjivgQ.d.ts} +29 -7
  52. package/dist/production/{index-react-server-client-DPrDrCew.d.mts → index-react-server-client-CACgcj2J.d.mts} +19 -5
  53. package/dist/production/index-react-server-client.d.mts +3 -3
  54. package/dist/production/index-react-server-client.d.ts +3 -3
  55. package/dist/production/index-react-server-client.js +4 -4
  56. package/dist/production/index-react-server-client.mjs +2 -2
  57. package/dist/production/index-react-server.d.mts +9 -1
  58. package/dist/production/index-react-server.d.ts +9 -1
  59. package/dist/production/index-react-server.js +144 -121
  60. package/dist/production/index-react-server.mjs +143 -120
  61. package/dist/production/index.d.mts +15 -14
  62. package/dist/production/index.d.ts +15 -14
  63. package/dist/production/index.js +137 -205
  64. package/dist/production/index.mjs +3 -5
  65. package/dist/{development/instrumentation-1q4YhLGP.d.ts → production/instrumentation-Dkmpzd13.d.ts} +2 -2
  66. package/dist/production/lib/types/internal.d.mts +2 -2
  67. package/dist/production/lib/types/internal.d.ts +2 -2
  68. package/dist/production/lib/types/internal.js +1 -1
  69. package/dist/production/lib/types/internal.mjs +1 -1
  70. package/dist/production/{register-CqK96Zfk.d.mts → register-CmkRspdl.d.mts} +1 -1
  71. package/dist/production/{register-CNAx3TXj.d.ts → register-roq_0qYo.d.ts} +1 -1
  72. package/docs/explanation/type-safety.md +1 -1
  73. package/docs/how-to/headers.md +2 -1
  74. package/docs/how-to/security.md +8 -6
  75. package/docs/how-to/status.md +1 -1
  76. package/docs/start/data/installation.md +4 -0
  77. package/docs/start/framework/deploying.md +4 -0
  78. package/docs/upgrading/future.md +222 -12
  79. package/docs/upgrading/remix.md +2 -2
  80. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { m as HTMLFormMethod, n as FormEncType, o as LoaderFunctionArgs, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, r as RouteObject, s as History, t as MaybePromise, u as MapRoutePropertiesFunction, v as Action, L as Location, w as DataRouteMatch, x as Submission, y as RouteData, z as DataStrategyFunction, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, I as RouteBranch, J as RouteManifest, U as UIMatch, T as To, K as Path, P as Params, O as InitialEntry, Q as NonIndexRouteObject, V as LazyRouteFunction, W as IndexRouteObject, X as RouteMatch, Y as TrackedPromise } from './data-U8FS-wNn.mjs';
1
+ import { m as HTMLFormMethod, n as FormEncType, o as LoaderFunctionArgs, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, r as RouteObject, s as History, t as MaybePromise, u as MapRoutePropertiesFunction, v as Action, L as Location, w as DataRouteMatch, x as Submission, y as RouteData, z as DataStrategyFunction, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, I as RouteBranch, J as RouteManifest, U as UIMatch, T as To, K as Path, P as Params, O as InitialEntry, Q as NonIndexRouteObject, V as LazyRouteFunction, W as IndexRouteObject, X as RouteMatch, Y as TrackedPromise } from './data-DEjBmEfD.mjs';
2
2
  import * as React from 'react';
3
3
 
4
4
  type ServerInstrumentation = {
@@ -838,6 +838,10 @@ interface MemoryRouterOpts {
838
838
  * in-memory [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
839
839
  * stack. Useful for non-browser environments without a DOM API.
840
840
  *
841
+ * Data Routers should not be held in React state. You should create your router
842
+ * once outside of the React tree and pass it to {@link RouterProvider | `<RouterProvider>`}.
843
+ * You can use `patchRoutesOnNavigation` to add additional routes programmatically.
844
+ *
841
845
  * @public
842
846
  * @category Data Routers
843
847
  * @mode data
@@ -872,7 +876,9 @@ interface ClientOnErrorFunction {
872
876
  */
873
877
  interface RouterProviderProps {
874
878
  /**
875
- * The {@link DataRouter} instance to use for navigation and data fetching.
879
+ * The {@link DataRouter} instance to use for navigation and data fetching. The
880
+ * router prop should be a single router instance created outside of the React
881
+ * tree. Avoid creating new routers during React renders/re-renders.
876
882
  */
877
883
  router: Router$1;
878
884
  /**
@@ -926,7 +932,9 @@ interface RouterProviderProps {
926
932
  }
927
933
  /**
928
934
  * Render the UI for the given {@link DataRouter}. This component should
929
- * typically be at the top of an app's element tree.
935
+ * typically be at the top of an app's element tree. The router prop should
936
+ * be a single router instance created outside of the React tree. Avoid
937
+ * creating new routers during React renders/re-renders.
930
938
  *
931
939
  * ```tsx
932
940
  * import { createBrowserRouter } from "react-router";
@@ -1768,4 +1776,4 @@ interface RouteContextObject {
1768
1776
  }
1769
1777
  declare const RouteContext: React.Context<RouteContextObject>;
1770
1778
 
1771
- export { createRoutesFromElements as $, AwaitContextProvider as A, type BlockerFunction as B, type ClientInstrumentation as C, type RouteProps as D, type RouterProps as E, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, type InstrumentRequestHandlerFunction as I, type RoutesProps as J, Await as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateOptions as N, type OutletProps as O, type PathRouteProps as P, MemoryRouter as Q, type RouterInit as R, type StaticHandler as S, Navigate as T, Outlet as U, Route as V, Router as W, RouterProvider as X, Routes as Y, createMemoryRouter as Z, createRoutesFromChildren as _, type RouterProviderProps as a, renderMatches as a0, createRouter as a1, DataRouterContext as a2, DataRouterStateContext as a3, FetchersContext as a4, LocationContext as a5, NavigationContext as a6, RouteContext as a7, ViewTransitionContext as a8, hydrationRouteProperties as a9, mapRouteProperties as aa, WithComponentProps as ab, withComponentProps as ac, WithHydrateFallbackProps as ad, withHydrateFallbackProps as ae, WithErrorBoundaryProps as af, withErrorBoundaryProps as ag, type FutureConfig as ah, type CreateStaticHandlerOptions as ai, type ClientOnErrorFunction as b, type Router$1 as c, type NavigationStates as d, type Blocker as e, type RelativeRoutingType as f, type RouterState as g, type GetScrollRestorationKeyFunction as h, type StaticHandlerContext as i, type Navigation as j, type RouterSubscriber as k, type RouterNavigateOptions as l, type RouterFetchOptions as m, type RevalidationState as n, type ServerInstrumentation as o, type InstrumentRouterFunction as p, type InstrumentRouteFunction as q, type InstrumentationHandlerResult as r, IDLE_NAVIGATION as s, IDLE_FETCHER as t, IDLE_BLOCKER as u, type Navigator as v, type AwaitProps as w, type IndexRouteProps as x, type MemoryRouterProps as y, type NavigateProps as z };
1779
+ export { createRoutesFromElements as $, AwaitContextProvider as A, type BlockerFunction as B, type ClientInstrumentation as C, type RouteProps as D, type RouterProps as E, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, type InstrumentRequestHandlerFunction as I, type RoutesProps as J, Await as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateOptions as N, type OutletProps as O, type PathRouteProps as P, MemoryRouter as Q, type RouterInit as R, type StaticHandler as S, Navigate as T, Outlet as U, Route as V, Router as W, RouterProvider as X, Routes as Y, createMemoryRouter as Z, createRoutesFromChildren as _, type RouterProviderProps as a, renderMatches as a0, createRouter as a1, DataRouterContext as a2, DataRouterStateContext as a3, FetchersContext as a4, LocationContext as a5, NavigationContext as a6, RouteContext as a7, ViewTransitionContext as a8, hydrationRouteProperties as a9, mapRouteProperties as aa, WithComponentProps as ab, withComponentProps as ac, WithHydrateFallbackProps as ad, withHydrateFallbackProps as ae, WithErrorBoundaryProps as af, withErrorBoundaryProps as ag, type FutureConfig as ah, type CreateStaticHandlerOptions as ai, type ClientOnErrorFunction as b, type Router$1 as c, type NavigationStates as d, type Blocker as e, type RelativeRoutingType as f, type GetScrollRestorationKeyFunction as g, type StaticHandlerContext as h, type Navigation as i, type RouterState as j, type RouterSubscriber as k, type RouterNavigateOptions as l, type RouterFetchOptions as m, type RevalidationState as n, type ServerInstrumentation as o, type InstrumentRouterFunction as p, type InstrumentRouteFunction as q, type InstrumentationHandlerResult as r, IDLE_NAVIGATION as s, IDLE_FETCHER as t, IDLE_BLOCKER as u, type Navigator as v, type AwaitProps as w, type IndexRouteProps as x, type MemoryRouterProps as y, type NavigateProps as z };
@@ -961,6 +961,8 @@ interface RouteMeta<RouteObjectType extends RouteObject = RouteObject> {
961
961
  caseSensitive: boolean;
962
962
  childrenIndex: number;
963
963
  route: RouteObjectType;
964
+ matcher?: RegExp;
965
+ compiledParams?: CompiledPathParam[];
964
966
  }
965
967
  /**
966
968
  * @private
@@ -1045,6 +1047,10 @@ interface PathMatch<ParamKey extends string = string> {
1045
1047
  * or `null` if it does not match.
1046
1048
  */
1047
1049
  declare function matchPath<Path extends string>(pattern: PathPattern<Path> | Path, pathname: string): PathMatch<ParamParseKey<Path>> | null;
1050
+ type CompiledPathParam = {
1051
+ paramName: string;
1052
+ isOptional?: boolean;
1053
+ };
1048
1054
  /**
1049
1055
  * Returns a resolved {@link Path} object relative to the given pathname.
1050
1056
  *
@@ -1332,7 +1338,9 @@ interface PageLinkDescriptor extends Omit<HtmlLinkDescriptor, "href" | "rel" | "
1332
1338
  /**
1333
1339
  * A [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce)
1334
1340
  * attribute to render on the [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
1335
- * element
1341
+ * element. If not provided in Framework Mode, it will default to any
1342
+ * {@link ServerRouter | `<ServerRouter nonce>`} prop.
1343
+
1336
1344
  */
1337
1345
  nonce?: string | undefined;
1338
1346
  /**
@@ -961,6 +961,8 @@ interface RouteMeta<RouteObjectType extends RouteObject = RouteObject> {
961
961
  caseSensitive: boolean;
962
962
  childrenIndex: number;
963
963
  route: RouteObjectType;
964
+ matcher?: RegExp;
965
+ compiledParams?: CompiledPathParam[];
964
966
  }
965
967
  /**
966
968
  * @private
@@ -1045,6 +1047,10 @@ interface PathMatch<ParamKey extends string = string> {
1045
1047
  * or `null` if it does not match.
1046
1048
  */
1047
1049
  declare function matchPath<Path extends string>(pattern: PathPattern<Path> | Path, pathname: string): PathMatch<ParamParseKey<Path>> | null;
1050
+ type CompiledPathParam = {
1051
+ paramName: string;
1052
+ isOptional?: boolean;
1053
+ };
1048
1054
  /**
1049
1055
  * Returns a resolved {@link Path} object relative to the given pathname.
1050
1056
  *
@@ -1332,7 +1338,9 @@ interface PageLinkDescriptor extends Omit<HtmlLinkDescriptor, "href" | "rel" | "
1332
1338
  /**
1333
1339
  * A [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce)
1334
1340
  * attribute to render on the [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
1335
- * element
1341
+ * element. If not provided in Framework Mode, it will default to any
1342
+ * {@link ServerRouter | `<ServerRouter nonce>`} prop.
1343
+
1336
1344
  */
1337
1345
  nonce?: string | undefined;
1338
1346
  /**
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
- import { a as RouterProviderProps$1, R as RouterInit, C as ClientInstrumentation, b as ClientOnErrorFunction } from './context-CmHpk1Ws.mjs';
3
- export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-CGcs-0pD.mjs';
4
- import './data-U8FS-wNn.mjs';
2
+ import { a as RouterProviderProps$1, R as RouterInit, C as ClientInstrumentation, b as ClientOnErrorFunction } from './context-CeD5LmaF.mjs';
3
+ export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-DBmQ1yAR.mjs';
4
+ import './data-DEjBmEfD.mjs';
5
5
 
6
6
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
7
7
  declare function RouterProvider(props: RouterProviderProps): React.JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { RouterProviderProps as RouterProviderProps$1, RouterInit, ClientOnErrorFunction } from 'react-router';
3
- import { C as ClientInstrumentation } from './instrumentation-1q4YhLGP.js';
4
- export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-D3uq9sI1.js';
5
- import './data-D4xhSy90.js';
3
+ import { C as ClientInstrumentation } from './instrumentation-Dkmpzd13.js';
4
+ export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-B2PdsXXH.js';
5
+ import './data-CjO11-hU.js';
6
6
 
7
7
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
8
8
  declare function RouterProvider(props: RouterProviderProps): React.JSX.Element;
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2
- * react-router v7.17.0
2
+ * react-router v7.18.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -13,7 +13,7 @@
13
13
 
14
14
 
15
15
 
16
- var _chunkCTIXC7EVjs = require('./chunk-CTIXC7EV.js');
16
+ var _chunkGOIER6MLjs = require('./chunk-GOIER6ML.js');
17
17
 
18
18
 
19
19
 
@@ -34,7 +34,10 @@ var _chunkCTIXC7EVjs = require('./chunk-CTIXC7EV.js');
34
34
 
35
35
 
36
36
 
37
- var _chunkRTRY3JFTjs = require('./chunk-RTRY3JFT.js');
37
+
38
+
39
+
40
+ var _chunkIEF7VMTAjs = require('./chunk-IEF7VMTA.js');
38
41
 
39
42
  // lib/dom-export/dom-router-provider.tsx
40
43
  var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
@@ -62,7 +65,6 @@ function RouterProvider2(props) {
62
65
 
63
66
 
64
67
 
65
-
66
68
  var ssrInfo = null;
67
69
  var router = null;
68
70
  function initSsrInfo() {
@@ -147,9 +149,6 @@ function createHydratedRouter({
147
149
  basename: _optionalChain([window, 'access', _17 => _17.__reactRouterContext, 'optionalAccess', _18 => _18.basename]),
148
150
  isSpaMode: ssrInfo.context.isSpaMode
149
151
  });
150
- if (hydrationData && hydrationData.errors) {
151
- hydrationData.errors = _reactrouter.UNSAFE_deserializeErrors.call(void 0, hydrationData.errors);
152
- }
153
152
  }
154
153
  if (window.history.state && window.history.state.masked) {
155
154
  window.history.replaceState(
@@ -214,7 +213,7 @@ function HydratedRouter(props) {
214
213
  }, []);
215
214
  React2.useEffect(() => {
216
215
  if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
217
- document.querySelectorAll(`[${_chunkRTRY3JFTjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
216
+ document.querySelectorAll(`[${_chunkIEF7VMTAjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
218
217
  }
219
218
  }, [criticalCss]);
220
219
  let [location2, setLocation] = React2.useState(router.state.location);
@@ -307,15 +306,16 @@ function createCallServer({
307
306
  // @ts-expect-error - Needs React 19 types
308
307
  Promise.resolve(payloadPromise).then(async (payload) => {
309
308
  if (payload.type === "redirect") {
310
- if (payload.reload || isExternalLocation(payload.location)) {
311
- if (hasInvalidProtocol(payload.location)) {
309
+ let location2 = normalizeRedirectLocation(payload.location);
310
+ if (payload.reload || isExternalLocation(location2)) {
311
+ if (_chunkIEF7VMTAjs.hasInvalidProtocol.call(void 0, location2)) {
312
312
  throw new Error("Invalid redirect location");
313
313
  }
314
- window.location.href = payload.location;
314
+ window.location.href = location2;
315
315
  return;
316
316
  }
317
317
  React3.startTransition(() => {
318
- globalVar.__reactRouterDataRouter.navigate(payload.location, {
318
+ globalVar.__reactRouterDataRouter.navigate(location2, {
319
319
  replace: payload.replace
320
320
  });
321
321
  });
@@ -327,15 +327,16 @@ function createCallServer({
327
327
  const rerender = await payload.rerender;
328
328
  if (rerender && landedActionId < actionId && globalVar.__routerActionID <= actionId) {
329
329
  if (rerender.type === "redirect") {
330
- if (rerender.reload || isExternalLocation(rerender.location)) {
331
- if (hasInvalidProtocol(rerender.location)) {
330
+ let location2 = normalizeRedirectLocation(rerender.location);
331
+ if (rerender.reload || isExternalLocation(location2)) {
332
+ if (_chunkIEF7VMTAjs.hasInvalidProtocol.call(void 0, location2)) {
332
333
  throw new Error("Invalid redirect location");
333
334
  }
334
- window.location.href = rerender.location;
335
+ window.location.href = location2;
335
336
  return;
336
337
  }
337
338
  React3.startTransition(() => {
338
- globalVar.__reactRouterDataRouter.navigate(rerender.location, {
339
+ globalVar.__reactRouterDataRouter.navigate(location2, {
339
340
  replace: rerender.replace
340
341
  });
341
342
  });
@@ -393,7 +394,7 @@ function createRouterFromPayload({
393
394
  };
394
395
  if (payload.type !== "render") throw new Error("Invalid payload type");
395
396
  globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {}));
396
- _chunkCTIXC7EVjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
397
+ _chunkGOIER6MLjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
397
398
  let routes = payload.matches.reduceRight((previous, match) => {
398
399
  const route = createRouteFromServerManifest(
399
400
  match,
@@ -407,12 +408,12 @@ function createRouterFromPayload({
407
408
  return [route];
408
409
  }, []);
409
410
  let applyPatchesPromise;
410
- globalVar.__reactRouterDataRouter = _chunkRTRY3JFTjs.createRouter.call(void 0, {
411
+ globalVar.__reactRouterDataRouter = _chunkIEF7VMTAjs.createRouter.call(void 0, {
411
412
  routes,
412
413
  getContext,
413
414
  basename: payload.basename,
414
- history: _chunkRTRY3JFTjs.createBrowserHistory.call(void 0, ),
415
- hydrationData: _chunkCTIXC7EVjs.getHydrationData.call(void 0, {
415
+ history: _chunkIEF7VMTAjs.createBrowserHistory.call(void 0, ),
416
+ hydrationData: _chunkGOIER6MLjs.getHydrationData.call(void 0, {
416
417
  state: {
417
418
  loaderData: payload.loaderData,
418
419
  actionData: payload.actionData,
@@ -421,7 +422,7 @@ function createRouterFromPayload({
421
422
  routes,
422
423
  getRouteInfo: (routeId) => {
423
424
  let match = payload.matches.find((m) => m.id === routeId);
424
- _chunkRTRY3JFTjs.invariant.call(void 0, match, "Route not found in payload");
425
+ _chunkIEF7VMTAjs.invariant.call(void 0, match, "Route not found in payload");
425
426
  return {
426
427
  clientLoader: match.clientLoader,
427
428
  hasLoader: match.hasLoader,
@@ -536,9 +537,9 @@ function createRouterFromPayload({
536
537
  routeModules: globalVar.__reactRouterRouteModules
537
538
  };
538
539
  }
539
- var renderedRoutesContext = _chunkRTRY3JFTjs.createContext.call(void 0, );
540
+ var renderedRoutesContext = _chunkIEF7VMTAjs.createContext.call(void 0, );
540
541
  function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
541
- let dataStrategy = _chunkRTRY3JFTjs.getSingleFetchDataStrategyImpl.call(void 0,
542
+ let dataStrategy = _chunkIEF7VMTAjs.getSingleFetchDataStrategyImpl.call(void 0,
542
543
  getRouter,
543
544
  (match) => {
544
545
  let M = match;
@@ -595,20 +596,20 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
595
596
  function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
596
597
  return async (args, basename, trailingSlashAware, targetRoutes) => {
597
598
  let { request, context } = args;
598
- let url = _chunkRTRY3JFTjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
599
+ let url = _chunkIEF7VMTAjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
599
600
  if (request.method === "GET") {
600
- url = _chunkRTRY3JFTjs.stripIndexParam.call(void 0, url);
601
+ url = _chunkIEF7VMTAjs.stripIndexParam.call(void 0, url);
601
602
  if (targetRoutes) {
602
603
  url.searchParams.set("_routes", targetRoutes.join(","));
603
604
  }
604
605
  }
605
606
  let res = await fetchImplementation(
606
- new Request(url, await _chunkRTRY3JFTjs.createRequestInit.call(void 0, request))
607
+ new Request(url, await _chunkIEF7VMTAjs.createRequestInit.call(void 0, request))
607
608
  );
608
609
  if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
609
- throw new (0, _chunkRTRY3JFTjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
610
+ throw new (0, _chunkIEF7VMTAjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
610
611
  }
611
- _chunkRTRY3JFTjs.invariant.call(void 0, res.body, "No response body to decode");
612
+ _chunkIEF7VMTAjs.invariant.call(void 0, res.body, "No response body to decode");
612
613
  try {
613
614
  const payload = await createFromReadableStream(res.body, {
614
615
  temporaryReferences: void 0
@@ -632,7 +633,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
632
633
  }
633
634
  context.get(renderedRoutesContext).push(...payload.matches);
634
635
  let results = { routes: {} };
635
- const dataKey = _chunkRTRY3JFTjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
636
+ const dataKey = _chunkIEF7VMTAjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
636
637
  for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {
637
638
  results.routes[routeId] = { data };
638
639
  }
@@ -665,7 +666,7 @@ function RSCHydratedRouter({
665
666
  [createFromReadableStream, payload, fetchImplementation, getContext]
666
667
  );
667
668
  React3.useEffect(() => {
668
- _chunkRTRY3JFTjs.setIsHydrated.call(void 0, );
669
+ _chunkIEF7VMTAjs.setIsHydrated.call(void 0, );
669
670
  }, []);
670
671
  React3.useLayoutEffect(() => {
671
672
  const globalVar = window;
@@ -773,8 +774,8 @@ function RSCHydratedRouter({
773
774
  },
774
775
  routeModules
775
776
  };
776
- return /* @__PURE__ */ React3.createElement(_chunkRTRY3JFTjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkCTIXC7EVjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkRTRY3JFTjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
777
- _chunkRTRY3JFTjs.RouterProvider,
777
+ return /* @__PURE__ */ React3.createElement(_chunkIEF7VMTAjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkGOIER6MLjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkIEF7VMTAjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
778
+ _chunkIEF7VMTAjs.RouterProvider,
778
779
  {
779
780
  router: transitionEnabledRouter,
780
781
  flushSync: ReactDOM2.flushSync
@@ -790,8 +791,8 @@ function createRouteFromServerManifest(match, payload) {
790
791
  // the server loader flow regardless of whether the client loader calls
791
792
  // `serverLoader` or not, otherwise we'll have nothing to render.
792
793
  match.hasComponent && !match.element;
793
- _chunkRTRY3JFTjs.invariant.call(void 0, window.__reactRouterRouteModules);
794
- _chunkCTIXC7EVjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
794
+ _chunkIEF7VMTAjs.invariant.call(void 0, window.__reactRouterRouteModules);
795
+ _chunkGOIER6MLjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
795
796
  let dataRoute = {
796
797
  id: match.id,
797
798
  element: match.element,
@@ -839,7 +840,7 @@ function createRouteFromServerManifest(match, payload) {
839
840
  return await callSingleFetch(singleFetch);
840
841
  }
841
842
  }) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => {
842
- throw _chunkRTRY3JFTjs.noActionDefinedError.call(void 0, "action", match.id);
843
+ throw _chunkIEF7VMTAjs.noActionDefinedError.call(void 0, "action", match.id);
843
844
  },
844
845
  path: match.path,
845
846
  shouldRevalidate: match.shouldRevalidate,
@@ -851,7 +852,7 @@ function createRouteFromServerManifest(match, payload) {
851
852
  hasClientAction: match.clientAction != null
852
853
  };
853
854
  if (typeof dataRoute.loader === "function") {
854
- dataRoute.loader.hydrate = _chunkRTRY3JFTjs.shouldHydrateRouteLoader.call(void 0,
855
+ dataRoute.loader.hydrate = _chunkIEF7VMTAjs.shouldHydrateRouteLoader.call(void 0,
855
856
  match.id,
856
857
  match.clientLoader,
857
858
  match.hasLoader,
@@ -861,7 +862,7 @@ function createRouteFromServerManifest(match, payload) {
861
862
  return dataRoute;
862
863
  }
863
864
  function callSingleFetch(singleFetch) {
864
- _chunkRTRY3JFTjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
865
+ _chunkIEF7VMTAjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
865
866
  return singleFetch();
866
867
  }
867
868
  function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
@@ -869,7 +870,7 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
869
870
  let fn = type === "action" ? "serverAction()" : "serverLoader()";
870
871
  let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
871
872
  console.error(msg);
872
- throw new (0, _chunkRTRY3JFTjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
873
+ throw new (0, _chunkIEF7VMTAjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
873
874
  }
874
875
  }
875
876
  var nextPaths = /* @__PURE__ */ new Set();
@@ -892,11 +893,12 @@ function getManifestUrl(paths) {
892
893
  return url;
893
894
  }
894
895
  async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fetchImplementation, signal) {
896
+ paths = _chunkIEF7VMTAjs.getPathsWithAncestors.call(void 0, paths);
895
897
  let url = getManifestUrl(paths);
896
898
  if (url == null) {
897
899
  return;
898
900
  }
899
- if (url.toString().length > _chunkRTRY3JFTjs.URL_LIMIT) {
901
+ if (url.toString().length > _chunkIEF7VMTAjs.URL_LIMIT) {
900
902
  nextPaths.clear();
901
903
  return;
902
904
  }
@@ -939,12 +941,12 @@ function isExternalLocation(location2) {
939
941
  const newLocation = new URL(location2, window.location.href);
940
942
  return newLocation.origin !== window.location.origin;
941
943
  }
942
- function hasInvalidProtocol(location2) {
943
- try {
944
- return _chunkRTRY3JFTjs.invalidProtocols.includes(new URL(location2).protocol);
945
- } catch (e2) {
946
- return false;
944
+ function normalizeRedirectLocation(location2) {
945
+ if (_chunkIEF7VMTAjs.PROTOCOL_RELATIVE_URL_REGEX.test(location2)) {
946
+ let path = _chunkIEF7VMTAjs.resolvePath.call(void 0, location2);
947
+ return path.pathname + path.search + path.hash;
947
948
  }
949
+ return location2;
948
950
  }
949
951
  function cloneRoutes(routes) {
950
952
  if (!routes) return void 0;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.17.0
2
+ * react-router v7.18.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -11,14 +11,14 @@
11
11
  "use client";
12
12
  import {
13
13
  RSCRouterGlobalErrorBoundary,
14
- deserializeErrors,
15
14
  getHydrationData,
16
15
  populateRSCRouteModules
17
- } from "./chunk-5TQZEVD5.mjs";
16
+ } from "./chunk-3MA7PLKB.mjs";
18
17
  import {
19
18
  CRITICAL_CSS_DATA_ATTRIBUTE,
20
19
  ErrorResponseImpl,
21
20
  FrameworkContext,
21
+ PROTOCOL_RELATIVE_URL_REGEX,
22
22
  RSCRouterContext,
23
23
  RemixErrorBoundary,
24
24
  RouterProvider,
@@ -31,20 +31,22 @@ import {
31
31
  createRouter,
32
32
  decodeViaTurboStream,
33
33
  getPatchRoutesOnNavigationFunction,
34
+ getPathsWithAncestors,
34
35
  getSingleFetchDataStrategyImpl,
35
36
  getTurboStreamSingleFetchDataStrategy,
37
+ hasInvalidProtocol,
36
38
  hydrationRouteProperties,
37
- invalidProtocols,
38
39
  invariant,
39
40
  isMutationMethod,
40
41
  mapRouteProperties,
41
42
  noActionDefinedError,
43
+ resolvePath,
42
44
  setIsHydrated,
43
45
  shouldHydrateRouteLoader,
44
46
  singleFetchUrl,
45
47
  stripIndexParam,
46
48
  useFogOFWarDiscovery
47
- } from "./chunk-OSYEOCBT.mjs";
49
+ } from "./chunk-3WDNQUW5.mjs";
48
50
 
49
51
  // lib/dom-export/dom-router-provider.tsx
50
52
  import * as React from "react";
@@ -139,9 +141,6 @@ function createHydratedRouter({
139
141
  basename: window.__reactRouterContext?.basename,
140
142
  isSpaMode: ssrInfo.context.isSpaMode
141
143
  });
142
- if (hydrationData && hydrationData.errors) {
143
- hydrationData.errors = deserializeErrors(hydrationData.errors);
144
- }
145
144
  }
146
145
  if (window.history.state && window.history.state.masked) {
147
146
  window.history.replaceState(
@@ -299,15 +298,16 @@ function createCallServer({
299
298
  // @ts-expect-error - Needs React 19 types
300
299
  Promise.resolve(payloadPromise).then(async (payload) => {
301
300
  if (payload.type === "redirect") {
302
- if (payload.reload || isExternalLocation(payload.location)) {
303
- if (hasInvalidProtocol(payload.location)) {
301
+ let location2 = normalizeRedirectLocation(payload.location);
302
+ if (payload.reload || isExternalLocation(location2)) {
303
+ if (hasInvalidProtocol(location2)) {
304
304
  throw new Error("Invalid redirect location");
305
305
  }
306
- window.location.href = payload.location;
306
+ window.location.href = location2;
307
307
  return;
308
308
  }
309
309
  React3.startTransition(() => {
310
- globalVar.__reactRouterDataRouter.navigate(payload.location, {
310
+ globalVar.__reactRouterDataRouter.navigate(location2, {
311
311
  replace: payload.replace
312
312
  });
313
313
  });
@@ -319,15 +319,16 @@ function createCallServer({
319
319
  const rerender = await payload.rerender;
320
320
  if (rerender && landedActionId < actionId && globalVar.__routerActionID <= actionId) {
321
321
  if (rerender.type === "redirect") {
322
- if (rerender.reload || isExternalLocation(rerender.location)) {
323
- if (hasInvalidProtocol(rerender.location)) {
322
+ let location2 = normalizeRedirectLocation(rerender.location);
323
+ if (rerender.reload || isExternalLocation(location2)) {
324
+ if (hasInvalidProtocol(location2)) {
324
325
  throw new Error("Invalid redirect location");
325
326
  }
326
- window.location.href = rerender.location;
327
+ window.location.href = location2;
327
328
  return;
328
329
  }
329
330
  React3.startTransition(() => {
330
- globalVar.__reactRouterDataRouter.navigate(rerender.location, {
331
+ globalVar.__reactRouterDataRouter.navigate(location2, {
331
332
  replace: rerender.replace
332
333
  });
333
334
  });
@@ -884,6 +885,7 @@ function getManifestUrl(paths) {
884
885
  return url;
885
886
  }
886
887
  async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fetchImplementation, signal) {
888
+ paths = getPathsWithAncestors(paths);
887
889
  let url = getManifestUrl(paths);
888
890
  if (url == null) {
889
891
  return;
@@ -931,12 +933,12 @@ function isExternalLocation(location2) {
931
933
  const newLocation = new URL(location2, window.location.href);
932
934
  return newLocation.origin !== window.location.origin;
933
935
  }
934
- function hasInvalidProtocol(location2) {
935
- try {
936
- return invalidProtocols.includes(new URL(location2).protocol);
937
- } catch {
938
- return false;
936
+ function normalizeRedirectLocation(location2) {
937
+ if (PROTOCOL_RELATIVE_URL_REGEX.test(location2)) {
938
+ let path = resolvePath(location2);
939
+ return path.pathname + path.search + path.hash;
939
940
  }
941
+ return location2;
940
942
  }
941
943
  function cloneRoutes(routes) {
942
944
  if (!routes) return void 0;
@@ -1,6 +1,6 @@
1
- import { l as ServerInstrumentation, H as HydrationState, f as StaticHandlerContext, c as RelativeRoutingType, a as Router$1, d as RouterState, R as RouterInit, t as FutureConfig$1, C as ClientInstrumentation, e as GetScrollRestorationKeyFunction, F as Fetcher, B as BlockerFunction, u as CreateStaticHandlerOptions$1, S as StaticHandler } from './instrumentation-1q4YhLGP.js';
1
+ import { l as ServerInstrumentation, H as HydrationState, e as StaticHandlerContext, c as RelativeRoutingType, a as Router$1, g as RouterState, R as RouterInit, t as FutureConfig$1, C as ClientInstrumentation, d as GetScrollRestorationKeyFunction, F as Fetcher, B as BlockerFunction, u as CreateStaticHandlerOptions$1, S as StaticHandler } from './instrumentation-Dkmpzd13.js';
2
2
  import * as React from 'react';
3
- import { p as RouteManifest, aE as ServerRouteModule, t as MiddlewareEnabled, c as RouterContextProvider, u as AppLoadContext, s as LoaderFunctionArgs, a0 as ActionFunctionArgs, O as RouteModules, n as DataRouteObject, a as ClientLoaderFunction, o as RouteBranch, aF as TrackedPromise, f as History, T as To, L as Location, i as Action, ac as RouteMatch, Y as InitialEntry, _ as NonIndexRouteObject, a7 as LazyRouteFunction, Z as IndexRouteObject, P as Params, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, e as RouteObject, U as UIMatch, q as HTMLFormMethod, F as FormEncType, av as PageLinkDescriptor, Q as SerializeFrom } from './data-D4xhSy90.js';
3
+ import { p as RouteManifest, aE as ServerRouteModule, t as MiddlewareEnabled, c as RouterContextProvider, u as AppLoadContext, s as LoaderFunctionArgs, a0 as ActionFunctionArgs, O as RouteModules, n as DataRouteObject, a as ClientLoaderFunction, o as RouteBranch, aF as TrackedPromise, f as History, T as To, L as Location, i as Action, ac as RouteMatch, Y as InitialEntry, _ as NonIndexRouteObject, a7 as LazyRouteFunction, Z as IndexRouteObject, P as Params, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, e as RouteObject, U as UIMatch, q as HTMLFormMethod, F as FormEncType, av as PageLinkDescriptor, Q as SerializeFrom } from './data-CjO11-hU.js';
4
4
 
5
5
  type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
6
6
  interface ServerRoute extends Route$1 {
@@ -106,6 +106,7 @@ interface FrameworkContextObject {
106
106
  ssr: boolean;
107
107
  isSpaMode: boolean;
108
108
  routeDiscovery: ServerBuild["routeDiscovery"];
109
+ nonce?: string;
109
110
  serializeError?(error: Error): SerializedError;
110
111
  renderMeta?: {
111
112
  didRenderScripts?: boolean;
@@ -346,6 +347,10 @@ interface MemoryRouterOpts {
346
347
  * in-memory [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
347
348
  * stack. Useful for non-browser environments without a DOM API.
348
349
  *
350
+ * Data Routers should not be held in React state. You should create your router
351
+ * once outside of the React tree and pass it to {@link RouterProvider | `<RouterProvider>`}.
352
+ * You can use `patchRoutesOnNavigation` to add additional routes programmatically.
353
+ *
349
354
  * @public
350
355
  * @category Data Routers
351
356
  * @mode data
@@ -380,7 +385,9 @@ interface ClientOnErrorFunction {
380
385
  */
381
386
  interface RouterProviderProps {
382
387
  /**
383
- * The {@link DataRouter} instance to use for navigation and data fetching.
388
+ * The {@link DataRouter} instance to use for navigation and data fetching. The
389
+ * router prop should be a single router instance created outside of the React
390
+ * tree. Avoid creating new routers during React renders/re-renders.
384
391
  */
385
392
  router: Router$1;
386
393
  /**
@@ -434,7 +441,9 @@ interface RouterProviderProps {
434
441
  }
435
442
  /**
436
443
  * Render the UI for the given {@link DataRouter}. This component should
437
- * typically be at the top of an app's element tree.
444
+ * typically be at the top of an app's element tree. The router prop should
445
+ * be a single router instance created outside of the React tree. Avoid
446
+ * creating new routers during React renders/re-renders.
438
447
  *
439
448
  * ```tsx
440
449
  * import { createBrowserRouter } from "react-router";
@@ -1347,7 +1356,8 @@ interface LinksProps {
1347
1356
  /**
1348
1357
  * A [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce)
1349
1358
  * attribute to render on the [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
1350
- * element
1359
+ * element. If not provided in Framework Mode, it will default to any
1360
+ * {@link ServerRouter | `<ServerRouter nonce>`} prop.
1351
1361
  */
1352
1362
  nonce?: string | undefined;
1353
1363
  /**
@@ -1464,7 +1474,8 @@ type ScriptsProps = Omit<React.HTMLProps<HTMLScriptElement>, "async" | "children
1464
1474
  /**
1465
1475
  * A [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce)
1466
1476
  * attribute to render on the [`<script>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
1467
- * element
1477
+ * element. If not provided in Framework Mode, it will default to any
1478
+ * {@link ServerRouter | `<ServerRouter nonce>`} prop.
1468
1479
  */
1469
1480
  nonce?: string | undefined;
1470
1481
  };
@@ -1996,6 +2007,10 @@ interface DOMRouterOpts {
1996
2007
  * path via [`history.pushState`](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState)
1997
2008
  * and [`history.replaceState`](https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState).
1998
2009
  *
2010
+ * Data Routers should not be held in React state. You should create your router
2011
+ * once outside of the React tree and pass it to {@link RouterProvider | `<RouterProvider>`}.
2012
+ * You can use `patchRoutesOnNavigation` to add additional routes programmatically.
2013
+ *
1999
2014
  * @public
2000
2015
  * @category Data Routers
2001
2016
  * @mode data
@@ -2016,6 +2031,10 @@ declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts
2016
2031
  * Create a new {@link DataRouter| data router} that manages the application
2017
2032
  * path via the URL [`hash`](https://developer.mozilla.org/en-US/docs/Web/API/URL/hash).
2018
2033
  *
2034
+ * Data Routers should not be held in React state. You should create your router
2035
+ * once outside of the React tree and pass it to {@link RouterProvider | `<RouterProvider>`}.
2036
+ * You can use `patchRoutesOnNavigation` to add additional routes programmatically.
2037
+ *
2019
2038
  * @public
2020
2039
  * @category Data Routers
2021
2040
  * @mode data
@@ -2836,7 +2855,10 @@ type ScrollRestorationProps = ScriptsProps & {
2836
2855
  * }
2837
2856
  * ```
2838
2857
  *
2839
- * This component renders an inline `<script>` to prevent scroll flashing. The `nonce` prop will be passed down to the script tag to allow CSP nonce usage.
2858
+ * This component renders an inline `<script>` to prevent scroll flashing. The
2859
+ * `nonce` prop will be passed down to the script tag to allow CSP nonce usage.
2860
+ * If not provided in Framework Mode, it will default to any
2861
+ * {@link ServerRouter | `<ServerRouter nonce>`} prop.
2840
2862
  *
2841
2863
  * ```tsx
2842
2864
  * <ScrollRestoration nonce={cspNonce} />