react-router 7.10.1 → 7.11.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/development/{browser-BpxEZgZC.d.ts → browser-Cv4JZyZ5.d.mts} +4 -3
  3. package/dist/{production/browser-BpxEZgZC.d.ts → development/browser-o-qhcuhA.d.ts} +4 -3
  4. package/dist/{production/chunk-B3F6YMOF.js → development/chunk-2JY4UAJA.js} +111 -121
  5. package/dist/{production/chunk-YO5R3LGQ.js → development/chunk-GNDLROV6.js} +7 -7
  6. package/dist/development/{chunk-WWGJGFF6.mjs → chunk-JMJ3UQ3L.mjs} +231 -74
  7. package/dist/development/{chunk-RBZI3ZHD.js → chunk-SZQUWNVJ.js} +279 -110
  8. package/dist/development/{chunk-PMGK554W.mjs → chunk-YNUBSHFH.mjs} +147 -38
  9. package/dist/development/dom-export.d.mts +11 -10
  10. package/dist/development/dom-export.d.ts +12 -11
  11. package/dist/development/dom-export.js +30 -31
  12. package/dist/development/dom-export.mjs +6 -7
  13. package/dist/{production/index-react-server-client-CCjKYJTH.d.ts → development/index-react-server-client-Cv5Q9lf0.d.ts} +60 -14
  14. package/dist/development/{index-react-server-client-CipGfVBI.d.mts → index-react-server-client-P7VgYu6T.d.mts} +60 -14
  15. package/dist/development/index-react-server-client.d.mts +2 -2
  16. package/dist/development/index-react-server-client.d.ts +2 -2
  17. package/dist/development/index-react-server-client.js +4 -4
  18. package/dist/development/index-react-server-client.mjs +2 -2
  19. package/dist/development/index-react-server.d.mts +4 -2
  20. package/dist/development/index-react-server.d.ts +4 -2
  21. package/dist/development/index-react-server.js +72 -19
  22. package/dist/development/index-react-server.mjs +72 -19
  23. package/dist/development/index.d.mts +17 -16
  24. package/dist/development/index.d.ts +17 -16
  25. package/dist/development/index.js +220 -111
  26. package/dist/development/index.mjs +3 -3
  27. package/dist/{production/instrumentation-BB0wRuqz.d.ts → development/instrumentation-BlrVzjbg.d.ts} +30 -15
  28. package/dist/development/lib/types/internal.d.mts +2 -2
  29. package/dist/development/lib/types/internal.d.ts +2 -2
  30. package/dist/development/lib/types/internal.js +1 -1
  31. package/dist/development/lib/types/internal.mjs +1 -1
  32. package/dist/development/{register-ODDAAYlf.d.ts → register-BGQUMCK4.d.ts} +1 -1
  33. package/dist/development/{register-C1RwVJAt.d.mts → register-DTJJbt1o.d.mts} +1 -1
  34. package/dist/development/{router-CwNp5l9u.d.mts → router-5fbeEIMQ.d.mts} +30 -15
  35. package/dist/{development/browser-C5z6FZmz.d.mts → production/browser-Cv4JZyZ5.d.mts} +4 -3
  36. package/dist/production/{browser-C5z6FZmz.d.mts → browser-o-qhcuhA.d.ts} +4 -3
  37. package/dist/production/{chunk-UQPBOMFP.js → chunk-2HFJAX7U.js} +279 -110
  38. package/dist/{development/chunk-FKYGG5Z2.js → production/chunk-BEXOWXJO.js} +7 -7
  39. package/dist/production/{chunk-TDCOAFPJ.mjs → chunk-E6GYEQUT.mjs} +147 -38
  40. package/dist/production/{chunk-ANIOYBQK.mjs → chunk-TINMVEA2.mjs} +231 -74
  41. package/dist/{development/chunk-HMTWJNYB.js → production/chunk-ZMYPVUNZ.js} +111 -121
  42. package/dist/production/dom-export.d.mts +11 -10
  43. package/dist/production/dom-export.d.ts +12 -11
  44. package/dist/production/dom-export.js +30 -31
  45. package/dist/production/dom-export.mjs +6 -7
  46. package/dist/{development/index-react-server-client-CCjKYJTH.d.ts → production/index-react-server-client-Cv5Q9lf0.d.ts} +60 -14
  47. package/dist/production/{index-react-server-client-CipGfVBI.d.mts → index-react-server-client-P7VgYu6T.d.mts} +60 -14
  48. package/dist/production/index-react-server-client.d.mts +2 -2
  49. package/dist/production/index-react-server-client.d.ts +2 -2
  50. package/dist/production/index-react-server-client.js +4 -4
  51. package/dist/production/index-react-server-client.mjs +2 -2
  52. package/dist/production/index-react-server.d.mts +4 -2
  53. package/dist/production/index-react-server.d.ts +4 -2
  54. package/dist/production/index-react-server.js +72 -19
  55. package/dist/production/index-react-server.mjs +72 -19
  56. package/dist/production/index.d.mts +17 -16
  57. package/dist/production/index.d.ts +17 -16
  58. package/dist/production/index.js +220 -111
  59. package/dist/production/index.mjs +3 -3
  60. package/dist/{development/instrumentation-BB0wRuqz.d.ts → production/instrumentation-BlrVzjbg.d.ts} +30 -15
  61. package/dist/production/lib/types/internal.d.mts +2 -2
  62. package/dist/production/lib/types/internal.d.ts +2 -2
  63. package/dist/production/lib/types/internal.js +1 -1
  64. package/dist/production/lib/types/internal.mjs +1 -1
  65. package/dist/production/{register-ODDAAYlf.d.ts → register-BGQUMCK4.d.ts} +1 -1
  66. package/dist/production/{register-C1RwVJAt.d.mts → register-DTJJbt1o.d.mts} +1 -1
  67. package/dist/production/{router-CwNp5l9u.d.mts → router-5fbeEIMQ.d.mts} +30 -15
  68. package/package.json +5 -4
@@ -1,4 +1,4 @@
1
- import { bE as RouteManifest, o as RouteModules, Q as HydrationState, a1 as DataRouteObject, a as ClientLoaderFunction, a5 as StaticHandlerContext, bF as ServerRouteModule, q as MiddlewareEnabled, c as RouterContextProvider, r as AppLoadContext, al as LoaderFunctionArgs, ac as ActionFunctionArgs, au as unstable_ServerInstrumentation, aj as HTMLFormMethod, ah as FormEncType, w as RelativeRoutingType, bh as PageLinkDescriptor, T as To, bG as History, a4 as GetScrollRestorationKeyFunction, e as RouterInit, bH as FutureConfig$1, u as unstable_ClientInstrumentation, p as DataStrategyFunction, a0 as PatchRoutesOnNavigationFunction, s as NavigateOptions, a6 as Fetcher, K as RouteObject, n as Router, v as SerializeFrom, B as BlockerFunction, L as Location, bI as CreateStaticHandlerOptions$1, a2 as StaticHandler } from './instrumentation-BB0wRuqz.js';
1
+ import { bE as RouteManifest, o as RouteModules, Q as HydrationState, a1 as DataRouteObject, a as ClientLoaderFunction, a5 as StaticHandlerContext, bF as ServerRouteModule, q as MiddlewareEnabled, c as RouterContextProvider, r as AppLoadContext, al as LoaderFunctionArgs, ac as ActionFunctionArgs, au as unstable_ServerInstrumentation, aj as HTMLFormMethod, ah as FormEncType, w as RelativeRoutingType, bh as PageLinkDescriptor, T as To, bG as History, a4 as GetScrollRestorationKeyFunction, e as RouterInit, bH as FutureConfig$1, u as unstable_ClientInstrumentation, p as DataStrategyFunction, a0 as PatchRoutesOnNavigationFunction, s as NavigateOptions, a6 as Fetcher, K as RouteObject, n as Router, v as SerializeFrom, B as BlockerFunction, L as Location, bI as CreateStaticHandlerOptions$1, a2 as StaticHandler } from './instrumentation-BlrVzjbg.js';
2
2
  import * as React from 'react';
3
3
 
4
4
  interface Route {
@@ -215,6 +215,18 @@ interface SharedSubmitOptions {
215
215
  * Enable flushSync for this submission's state updates
216
216
  */
217
217
  flushSync?: boolean;
218
+ /**
219
+ * Specify the default revalidation behavior after this submission
220
+ *
221
+ * If no `shouldRevalidate` functions are present on the active routes, then this
222
+ * value will be used directly. Otherwise it will be passed into `shouldRevalidate`
223
+ * so the route can make the final determination on revalidation. This can be
224
+ * useful when updating search params and you don't want to trigger a revalidation.
225
+ *
226
+ * By default (when not specified), loaders will revalidate according to the routers
227
+ * standard revalidation behavior.
228
+ */
229
+ unstable_defaultShouldRevalidate?: boolean;
218
230
  }
219
231
  /**
220
232
  * Submit options available to fetchers
@@ -251,7 +263,8 @@ interface SubmitOptions extends FetcherSubmitOptions {
251
263
 
252
264
  declare const FrameworkContext: React.Context<FrameworkContextObject | undefined>;
253
265
  /**
254
- * Defines the discovery behavior of the link:
266
+ * Defines the [lazy route discovery](../../explanation/lazy-route-discovery)
267
+ * behavior of the link/form:
255
268
  *
256
269
  * - "render" - default, discover the route when the link renders
257
270
  * - "none" - don't eagerly discover, only discover if the link is clicked
@@ -1112,16 +1125,16 @@ declare namespace HistoryRouter {
1112
1125
  */
1113
1126
  interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href"> {
1114
1127
  /**
1115
- * Defines the link discovery behavior
1128
+ * Defines the link [lazy route discovery](../../explanation/lazy-route-discovery) behavior.
1129
+ *
1130
+ * - **render** — default, discover the route when the link renders
1131
+ * - **none** — don't eagerly discover, only discover if the link is clicked
1116
1132
  *
1117
1133
  * ```tsx
1118
1134
  * <Link /> // default ("render")
1119
1135
  * <Link discover="render" />
1120
1136
  * <Link discover="none" />
1121
1137
  * ```
1122
- *
1123
- * - **render** — default, discover the route when the link renders
1124
- * - **none** — don't eagerly discover, only discover if the link is clicked
1125
1138
  */
1126
1139
  discover?: DiscoverBehavior;
1127
1140
  /**
@@ -1266,6 +1279,22 @@ interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>,
1266
1279
  * To apply specific styles for the transition, see {@link useViewTransitionState}
1267
1280
  */
1268
1281
  viewTransition?: boolean;
1282
+ /**
1283
+ * Specify the default revalidation behavior for the navigation.
1284
+ *
1285
+ * ```tsx
1286
+ * <Link to="/some/path" unstable_defaultShouldRevalidate={false} />
1287
+ * ```
1288
+ *
1289
+ * If no `shouldRevalidate` functions are present on the active routes, then this
1290
+ * value will be used directly. Otherwise it will be passed into `shouldRevalidate`
1291
+ * so the route can make the final determination on revalidation. This can be
1292
+ * useful when updating search params and you don't want to trigger a revalidation.
1293
+ *
1294
+ * By default (when not specified), loaders will revalidate according to the routers
1295
+ * standard revalidation behavior.
1296
+ */
1297
+ unstable_defaultShouldRevalidate?: boolean;
1269
1298
  }
1270
1299
  /**
1271
1300
  * A progressively enhanced [`<a href>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)
@@ -1295,6 +1324,7 @@ interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>,
1295
1324
  * @param {LinkProps.state} props.state n/a
1296
1325
  * @param {LinkProps.to} props.to n/a
1297
1326
  * @param {LinkProps.viewTransition} props.viewTransition [modes: framework, data] n/a
1327
+ * @param {LinkProps.unstable_defaultShouldRevalidate} props.unstable_defaultShouldRevalidate n/a
1298
1328
  */
1299
1329
  declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
1300
1330
  /**
@@ -1524,6 +1554,18 @@ interface SharedFormProps extends React.FormHTMLAttributes<HTMLFormElement> {
1524
1554
  * then this form will not do anything.
1525
1555
  */
1526
1556
  onSubmit?: React.FormEventHandler<HTMLFormElement>;
1557
+ /**
1558
+ * Specify the default revalidation behavior after this submission
1559
+ *
1560
+ * If no `shouldRevalidate` functions are present on the active routes, then this
1561
+ * value will be used directly. Otherwise it will be passed into `shouldRevalidate`
1562
+ * so the route can make the final determination on revalidation. This can be
1563
+ * useful when updating search params and you don't want to trigger a revalidation.
1564
+ *
1565
+ * By default (when not specified), loaders will revalidate according to the routers
1566
+ * standard revalidation behavior.
1567
+ */
1568
+ unstable_defaultShouldRevalidate?: boolean;
1527
1569
  }
1528
1570
  /**
1529
1571
  * Form props available to fetchers
@@ -1537,16 +1579,16 @@ interface FetcherFormProps extends SharedFormProps {
1537
1579
  */
1538
1580
  interface FormProps extends SharedFormProps {
1539
1581
  /**
1540
- * Defines the link discovery behavior. See {@link DiscoverBehavior}.
1582
+ * Defines the form [lazy route discovery](../../explanation/lazy-route-discovery) behavior.
1583
+ *
1584
+ * - **render** — default, discover the route when the form renders
1585
+ * - **none** — don't eagerly discover, only discover if the form is submitted
1541
1586
  *
1542
1587
  * ```tsx
1543
- * <Link /> // default ("render")
1544
- * <Link discover="render" />
1545
- * <Link discover="none" />
1588
+ * <Form /> // default ("render")
1589
+ * <Form discover="render" />
1590
+ * <Form discover="none" />
1546
1591
  * ```
1547
- *
1548
- * - **render** — default, discover the route when the link renders
1549
- * - **none** — don't eagerly discover, only discover if the link is clicked
1550
1592
  */
1551
1593
  discover?: DiscoverBehavior;
1552
1594
  /**
@@ -1631,6 +1673,7 @@ interface FormProps extends SharedFormProps {
1631
1673
  * @param {FormProps.replace} replace n/a
1632
1674
  * @param {FormProps.state} state n/a
1633
1675
  * @param {FormProps.viewTransition} viewTransition n/a
1676
+ * @param {FormProps.unstable_defaultShouldRevalidate} unstable_defaultShouldRevalidate n/a
1634
1677
  * @returns A progressively enhanced [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form) component
1635
1678
  */
1636
1679
  declare const Form: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<HTMLFormElement>>;
@@ -1721,18 +1764,21 @@ declare namespace ScrollRestoration {
1721
1764
  * @param options.viewTransition Enables a [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
1722
1765
  * for this navigation. To apply specific styles during the transition, see
1723
1766
  * {@link useViewTransitionState}. Defaults to `false`.
1767
+ * @param options.unstable_defaultShouldRevalidate Specify the default revalidation
1768
+ * behavior for the navigation. Defaults to `true`.
1724
1769
  * @param options.unstable_useTransitions Wraps the navigation in
1725
1770
  * [`React.startTransition`](https://react.dev/reference/react/startTransition)
1726
1771
  * for concurrent rendering. Defaults to `false`.
1727
1772
  * @returns A click handler function that can be used in a custom {@link Link} component.
1728
1773
  */
1729
- declare function useLinkClickHandler<E extends Element = HTMLAnchorElement>(to: To, { target, replace: replaceProp, state, preventScrollReset, relative, viewTransition, unstable_useTransitions, }?: {
1774
+ declare function useLinkClickHandler<E extends Element = HTMLAnchorElement>(to: To, { target, replace: replaceProp, state, preventScrollReset, relative, viewTransition, unstable_defaultShouldRevalidate, unstable_useTransitions, }?: {
1730
1775
  target?: React.HTMLAttributeAnchorTarget;
1731
1776
  replace?: boolean;
1732
1777
  state?: any;
1733
1778
  preventScrollReset?: boolean;
1734
1779
  relative?: RelativeRoutingType;
1735
1780
  viewTransition?: boolean;
1781
+ unstable_defaultShouldRevalidate?: boolean;
1736
1782
  unstable_useTransitions?: boolean;
1737
1783
  }): (event: React.MouseEvent<E, MouseEvent>) => void;
1738
1784
  /**
@@ -1,4 +1,4 @@
1
- import { bE as RouteManifest, q as RouteModules, W as HydrationState, a3 as DataRouteObject, a as ClientLoaderFunction, a7 as StaticHandlerContext, bF as ServerRouteModule, s as MiddlewareEnabled, c as RouterContextProvider, t as AppLoadContext, an as LoaderFunctionArgs, ae as ActionFunctionArgs, aw as unstable_ServerInstrumentation, al as HTMLFormMethod, aj as FormEncType, y as RelativeRoutingType, bh as PageLinkDescriptor, T as To, bG as History, a6 as GetScrollRestorationKeyFunction, e as RouterInit, bH as FutureConfig$1, u as unstable_ClientInstrumentation, r as DataStrategyFunction, a2 as PatchRoutesOnNavigationFunction, v as NavigateOptions, a8 as Fetcher, Q as RouteObject, p as Router, x as SerializeFrom, B as BlockerFunction, L as Location, bI as CreateStaticHandlerOptions$1, a4 as StaticHandler } from './router-CwNp5l9u.mjs';
1
+ import { bE as RouteManifest, q as RouteModules, W as HydrationState, a3 as DataRouteObject, a as ClientLoaderFunction, a7 as StaticHandlerContext, bF as ServerRouteModule, s as MiddlewareEnabled, c as RouterContextProvider, t as AppLoadContext, an as LoaderFunctionArgs, ae as ActionFunctionArgs, aw as unstable_ServerInstrumentation, al as HTMLFormMethod, aj as FormEncType, y as RelativeRoutingType, bh as PageLinkDescriptor, T as To, bG as History, a6 as GetScrollRestorationKeyFunction, e as RouterInit, bH as FutureConfig$1, u as unstable_ClientInstrumentation, r as DataStrategyFunction, a2 as PatchRoutesOnNavigationFunction, v as NavigateOptions, a8 as Fetcher, Q as RouteObject, p as Router, x as SerializeFrom, B as BlockerFunction, L as Location, bI as CreateStaticHandlerOptions$1, a4 as StaticHandler } from './router-5fbeEIMQ.mjs';
2
2
  import * as React from 'react';
3
3
 
4
4
  interface Route {
@@ -215,6 +215,18 @@ interface SharedSubmitOptions {
215
215
  * Enable flushSync for this submission's state updates
216
216
  */
217
217
  flushSync?: boolean;
218
+ /**
219
+ * Specify the default revalidation behavior after this submission
220
+ *
221
+ * If no `shouldRevalidate` functions are present on the active routes, then this
222
+ * value will be used directly. Otherwise it will be passed into `shouldRevalidate`
223
+ * so the route can make the final determination on revalidation. This can be
224
+ * useful when updating search params and you don't want to trigger a revalidation.
225
+ *
226
+ * By default (when not specified), loaders will revalidate according to the routers
227
+ * standard revalidation behavior.
228
+ */
229
+ unstable_defaultShouldRevalidate?: boolean;
218
230
  }
219
231
  /**
220
232
  * Submit options available to fetchers
@@ -251,7 +263,8 @@ interface SubmitOptions extends FetcherSubmitOptions {
251
263
 
252
264
  declare const FrameworkContext: React.Context<FrameworkContextObject | undefined>;
253
265
  /**
254
- * Defines the discovery behavior of the link:
266
+ * Defines the [lazy route discovery](../../explanation/lazy-route-discovery)
267
+ * behavior of the link/form:
255
268
  *
256
269
  * - "render" - default, discover the route when the link renders
257
270
  * - "none" - don't eagerly discover, only discover if the link is clicked
@@ -1112,16 +1125,16 @@ declare namespace HistoryRouter {
1112
1125
  */
1113
1126
  interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href"> {
1114
1127
  /**
1115
- * Defines the link discovery behavior
1128
+ * Defines the link [lazy route discovery](../../explanation/lazy-route-discovery) behavior.
1129
+ *
1130
+ * - **render** — default, discover the route when the link renders
1131
+ * - **none** — don't eagerly discover, only discover if the link is clicked
1116
1132
  *
1117
1133
  * ```tsx
1118
1134
  * <Link /> // default ("render")
1119
1135
  * <Link discover="render" />
1120
1136
  * <Link discover="none" />
1121
1137
  * ```
1122
- *
1123
- * - **render** — default, discover the route when the link renders
1124
- * - **none** — don't eagerly discover, only discover if the link is clicked
1125
1138
  */
1126
1139
  discover?: DiscoverBehavior;
1127
1140
  /**
@@ -1266,6 +1279,22 @@ interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>,
1266
1279
  * To apply specific styles for the transition, see {@link useViewTransitionState}
1267
1280
  */
1268
1281
  viewTransition?: boolean;
1282
+ /**
1283
+ * Specify the default revalidation behavior for the navigation.
1284
+ *
1285
+ * ```tsx
1286
+ * <Link to="/some/path" unstable_defaultShouldRevalidate={false} />
1287
+ * ```
1288
+ *
1289
+ * If no `shouldRevalidate` functions are present on the active routes, then this
1290
+ * value will be used directly. Otherwise it will be passed into `shouldRevalidate`
1291
+ * so the route can make the final determination on revalidation. This can be
1292
+ * useful when updating search params and you don't want to trigger a revalidation.
1293
+ *
1294
+ * By default (when not specified), loaders will revalidate according to the routers
1295
+ * standard revalidation behavior.
1296
+ */
1297
+ unstable_defaultShouldRevalidate?: boolean;
1269
1298
  }
1270
1299
  /**
1271
1300
  * A progressively enhanced [`<a href>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)
@@ -1295,6 +1324,7 @@ interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>,
1295
1324
  * @param {LinkProps.state} props.state n/a
1296
1325
  * @param {LinkProps.to} props.to n/a
1297
1326
  * @param {LinkProps.viewTransition} props.viewTransition [modes: framework, data] n/a
1327
+ * @param {LinkProps.unstable_defaultShouldRevalidate} props.unstable_defaultShouldRevalidate n/a
1298
1328
  */
1299
1329
  declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
1300
1330
  /**
@@ -1524,6 +1554,18 @@ interface SharedFormProps extends React.FormHTMLAttributes<HTMLFormElement> {
1524
1554
  * then this form will not do anything.
1525
1555
  */
1526
1556
  onSubmit?: React.FormEventHandler<HTMLFormElement>;
1557
+ /**
1558
+ * Specify the default revalidation behavior after this submission
1559
+ *
1560
+ * If no `shouldRevalidate` functions are present on the active routes, then this
1561
+ * value will be used directly. Otherwise it will be passed into `shouldRevalidate`
1562
+ * so the route can make the final determination on revalidation. This can be
1563
+ * useful when updating search params and you don't want to trigger a revalidation.
1564
+ *
1565
+ * By default (when not specified), loaders will revalidate according to the routers
1566
+ * standard revalidation behavior.
1567
+ */
1568
+ unstable_defaultShouldRevalidate?: boolean;
1527
1569
  }
1528
1570
  /**
1529
1571
  * Form props available to fetchers
@@ -1537,16 +1579,16 @@ interface FetcherFormProps extends SharedFormProps {
1537
1579
  */
1538
1580
  interface FormProps extends SharedFormProps {
1539
1581
  /**
1540
- * Defines the link discovery behavior. See {@link DiscoverBehavior}.
1582
+ * Defines the form [lazy route discovery](../../explanation/lazy-route-discovery) behavior.
1583
+ *
1584
+ * - **render** — default, discover the route when the form renders
1585
+ * - **none** — don't eagerly discover, only discover if the form is submitted
1541
1586
  *
1542
1587
  * ```tsx
1543
- * <Link /> // default ("render")
1544
- * <Link discover="render" />
1545
- * <Link discover="none" />
1588
+ * <Form /> // default ("render")
1589
+ * <Form discover="render" />
1590
+ * <Form discover="none" />
1546
1591
  * ```
1547
- *
1548
- * - **render** — default, discover the route when the link renders
1549
- * - **none** — don't eagerly discover, only discover if the link is clicked
1550
1592
  */
1551
1593
  discover?: DiscoverBehavior;
1552
1594
  /**
@@ -1631,6 +1673,7 @@ interface FormProps extends SharedFormProps {
1631
1673
  * @param {FormProps.replace} replace n/a
1632
1674
  * @param {FormProps.state} state n/a
1633
1675
  * @param {FormProps.viewTransition} viewTransition n/a
1676
+ * @param {FormProps.unstable_defaultShouldRevalidate} unstable_defaultShouldRevalidate n/a
1634
1677
  * @returns A progressively enhanced [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form) component
1635
1678
  */
1636
1679
  declare const Form: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<HTMLFormElement>>;
@@ -1721,18 +1764,21 @@ declare namespace ScrollRestoration {
1721
1764
  * @param options.viewTransition Enables a [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
1722
1765
  * for this navigation. To apply specific styles during the transition, see
1723
1766
  * {@link useViewTransitionState}. Defaults to `false`.
1767
+ * @param options.unstable_defaultShouldRevalidate Specify the default revalidation
1768
+ * behavior for the navigation. Defaults to `true`.
1724
1769
  * @param options.unstable_useTransitions Wraps the navigation in
1725
1770
  * [`React.startTransition`](https://react.dev/reference/react/startTransition)
1726
1771
  * for concurrent rendering. Defaults to `false`.
1727
1772
  * @returns A click handler function that can be used in a custom {@link Link} component.
1728
1773
  */
1729
- declare function useLinkClickHandler<E extends Element = HTMLAnchorElement>(to: To, { target, replace: replaceProp, state, preventScrollReset, relative, viewTransition, unstable_useTransitions, }?: {
1774
+ declare function useLinkClickHandler<E extends Element = HTMLAnchorElement>(to: To, { target, replace: replaceProp, state, preventScrollReset, relative, viewTransition, unstable_defaultShouldRevalidate, unstable_useTransitions, }?: {
1730
1775
  target?: React.HTMLAttributeAnchorTarget;
1731
1776
  replace?: boolean;
1732
1777
  state?: any;
1733
1778
  preventScrollReset?: boolean;
1734
1779
  relative?: RelativeRoutingType;
1735
1780
  viewTransition?: boolean;
1781
+ unstable_defaultShouldRevalidate?: boolean;
1736
1782
  unstable_useTransitions?: boolean;
1737
1783
  }): (event: React.MouseEvent<E, MouseEvent>) => void;
1738
1784
  /**
@@ -1,3 +1,3 @@
1
- export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aR as UNSAFE_AwaitContextProvider, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps } from './router-CwNp5l9u.mjs';
2
- export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-CipGfVBI.mjs';
1
+ export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aR as UNSAFE_AwaitContextProvider, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps } from './router-5fbeEIMQ.mjs';
2
+ export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-P7VgYu6T.mjs';
3
3
  import 'react';
@@ -1,3 +1,3 @@
1
- export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aP as UNSAFE_AwaitContextProvider, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps } from './instrumentation-BB0wRuqz.js';
2
- export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-CCjKYJTH.js';
1
+ export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aP as UNSAFE_AwaitContextProvider, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps } from './instrumentation-BlrVzjbg.js';
2
+ export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-Cv5Q9lf0.js';
3
3
  import 'react';
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
2
- * react-router v7.10.1
2
+ * react-router v7.11.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -19,7 +19,7 @@
19
19
 
20
20
 
21
21
 
22
- var _chunkHMTWJNYBjs = require('./chunk-HMTWJNYB.js');
22
+ var _chunk2JY4UAJAjs = require('./chunk-2JY4UAJA.js');
23
23
 
24
24
 
25
25
 
@@ -34,7 +34,7 @@ var _chunkHMTWJNYBjs = require('./chunk-HMTWJNYB.js');
34
34
 
35
35
 
36
36
 
37
- var _chunkRBZI3ZHDjs = require('./chunk-RBZI3ZHD.js');
37
+ var _chunkSZQUWNVJjs = require('./chunk-SZQUWNVJ.js');
38
38
 
39
39
 
40
40
 
@@ -58,4 +58,4 @@ var _chunkRBZI3ZHDjs = require('./chunk-RBZI3ZHD.js');
58
58
 
59
59
 
60
60
 
61
- exports.BrowserRouter = _chunkHMTWJNYBjs.BrowserRouter; exports.Form = _chunkHMTWJNYBjs.Form; exports.HashRouter = _chunkHMTWJNYBjs.HashRouter; exports.Link = _chunkHMTWJNYBjs.Link; exports.Links = _chunkRBZI3ZHDjs.Links; exports.MemoryRouter = _chunkRBZI3ZHDjs.MemoryRouter; exports.Meta = _chunkRBZI3ZHDjs.Meta; exports.NavLink = _chunkHMTWJNYBjs.NavLink; exports.Navigate = _chunkRBZI3ZHDjs.Navigate; exports.Outlet = _chunkRBZI3ZHDjs.Outlet; exports.Route = _chunkRBZI3ZHDjs.Route; exports.Router = _chunkRBZI3ZHDjs.Router; exports.RouterProvider = _chunkRBZI3ZHDjs.RouterProvider; exports.Routes = _chunkRBZI3ZHDjs.Routes; exports.ScrollRestoration = _chunkHMTWJNYBjs.ScrollRestoration; exports.StaticRouter = _chunkHMTWJNYBjs.StaticRouter; exports.StaticRouterProvider = _chunkHMTWJNYBjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkRBZI3ZHDjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkRBZI3ZHDjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkRBZI3ZHDjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkRBZI3ZHDjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkHMTWJNYBjs.HistoryRouter;
61
+ exports.BrowserRouter = _chunk2JY4UAJAjs.BrowserRouter; exports.Form = _chunk2JY4UAJAjs.Form; exports.HashRouter = _chunk2JY4UAJAjs.HashRouter; exports.Link = _chunk2JY4UAJAjs.Link; exports.Links = _chunkSZQUWNVJjs.Links; exports.MemoryRouter = _chunkSZQUWNVJjs.MemoryRouter; exports.Meta = _chunkSZQUWNVJjs.Meta; exports.NavLink = _chunk2JY4UAJAjs.NavLink; exports.Navigate = _chunkSZQUWNVJjs.Navigate; exports.Outlet = _chunkSZQUWNVJjs.Outlet; exports.Route = _chunkSZQUWNVJjs.Route; exports.Router = _chunkSZQUWNVJjs.Router; exports.RouterProvider = _chunkSZQUWNVJjs.RouterProvider; exports.Routes = _chunkSZQUWNVJjs.Routes; exports.ScrollRestoration = _chunk2JY4UAJAjs.ScrollRestoration; exports.StaticRouter = _chunk2JY4UAJAjs.StaticRouter; exports.StaticRouterProvider = _chunk2JY4UAJAjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkSZQUWNVJjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkSZQUWNVJjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkSZQUWNVJjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkSZQUWNVJjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunk2JY4UAJAjs.HistoryRouter;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.10.1
2
+ * react-router v7.11.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -32,7 +32,7 @@ import {
32
32
  WithComponentProps,
33
33
  WithErrorBoundaryProps,
34
34
  WithHydrateFallbackProps
35
- } from "./chunk-WWGJGFF6.mjs";
35
+ } from "./chunk-JMJ3UQ3L.mjs";
36
36
  export {
37
37
  BrowserRouter,
38
38
  Form,
@@ -1369,6 +1369,7 @@ type BaseNavigateOrFetchOptions = {
1369
1369
  preventScrollReset?: boolean;
1370
1370
  relative?: RelativeRoutingType;
1371
1371
  flushSync?: boolean;
1372
+ unstable_defaultShouldRevalidate?: boolean;
1372
1373
  };
1373
1374
  type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
1374
1375
  replace?: boolean;
@@ -2192,7 +2193,7 @@ type RSCMatch = {
2192
2193
  };
2193
2194
  type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
2194
2195
  type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
2195
- type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
2196
+ type DecodeReplyFunction = (reply: FormData | string, options: {
2196
2197
  temporaryReferences: unknown;
2197
2198
  }) => Promise<unknown[]>;
2198
2199
  type LoadServerActionFunction = (id: string) => Promise<Function>;
@@ -2277,7 +2278,8 @@ declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename,
2277
2278
  onError?: (error: unknown) => void;
2278
2279
  request: Request;
2279
2280
  routes: RSCRouteConfigEntry[];
2280
- generateResponse: (match: RSCMatch, { temporaryReferences, }: {
2281
+ generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: {
2282
+ onError(error: unknown): string | undefined;
2281
2283
  temporaryReferences: unknown;
2282
2284
  }) => Response;
2283
2285
  }): Promise<Response>;
@@ -1369,6 +1369,7 @@ type BaseNavigateOrFetchOptions = {
1369
1369
  preventScrollReset?: boolean;
1370
1370
  relative?: RelativeRoutingType;
1371
1371
  flushSync?: boolean;
1372
+ unstable_defaultShouldRevalidate?: boolean;
1372
1373
  };
1373
1374
  type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
1374
1375
  replace?: boolean;
@@ -2192,7 +2193,7 @@ type RSCMatch = {
2192
2193
  };
2193
2194
  type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
2194
2195
  type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
2195
- type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
2196
+ type DecodeReplyFunction = (reply: FormData | string, options: {
2196
2197
  temporaryReferences: unknown;
2197
2198
  }) => Promise<unknown[]>;
2198
2199
  type LoadServerActionFunction = (id: string) => Promise<Function>;
@@ -2277,7 +2278,8 @@ declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename,
2277
2278
  onError?: (error: unknown) => void;
2278
2279
  request: Request;
2279
2280
  routes: RSCRouteConfigEntry[];
2280
- generateResponse: (match: RSCMatch, { temporaryReferences, }: {
2281
+ generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: {
2282
+ onError(error: unknown): string | undefined;
2281
2283
  temporaryReferences: unknown;
2282
2284
  }) => Response;
2283
2285
  }): Promise<Response>;
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
27
27
  var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
28
28
 
29
29
  /**
30
- * react-router v7.10.1
30
+ * react-router v7.11.0
31
31
  *
32
32
  * Copyright (c) Remix Software Inc.
33
33
  *
@@ -1850,7 +1850,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
1850
1850
  handler: lazyRoutePromises.lazyHandlerPromise
1851
1851
  };
1852
1852
  }
1853
- function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null) {
1853
+ function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
1854
1854
  let isUsingNewApi = false;
1855
1855
  let _lazyPromises = getDataStrategyMatchLazyPromises(
1856
1856
  mapRouteProperties,
@@ -2393,6 +2393,43 @@ function prependCookies(parentHeaders, childHeaders) {
2393
2393
  }
2394
2394
  }
2395
2395
  var SINGLE_FETCH_REDIRECT_STATUS = 202;
2396
+
2397
+ // lib/errors.ts
2398
+ var ERROR_DIGEST_BASE = "REACT_ROUTER_ERROR";
2399
+ var ERROR_DIGEST_REDIRECT = "REDIRECT";
2400
+ var ERROR_DIGEST_ROUTE_ERROR_RESPONSE = "ROUTE_ERROR_RESPONSE";
2401
+ function createRedirectErrorDigest(response) {
2402
+ return `${ERROR_DIGEST_BASE}:${ERROR_DIGEST_REDIRECT}:${JSON.stringify({
2403
+ status: response.status,
2404
+ statusText: response.statusText,
2405
+ location: response.headers.get("Location"),
2406
+ reloadDocument: response.headers.get("X-Remix-Reload-Document") === "true",
2407
+ replace: response.headers.get("X-Remix-Replace") === "true"
2408
+ })}`;
2409
+ }
2410
+ function createRouteErrorResponseDigest(response) {
2411
+ let status = 500;
2412
+ let statusText = "";
2413
+ let data2;
2414
+ if (isDataWithResponseInit(response)) {
2415
+ status = response.init?.status ?? status;
2416
+ statusText = response.init?.statusText ?? statusText;
2417
+ data2 = response.data;
2418
+ } else {
2419
+ status = response.status;
2420
+ statusText = response.statusText;
2421
+ data2 = void 0;
2422
+ }
2423
+ return `${ERROR_DIGEST_BASE}:${ERROR_DIGEST_ROUTE_ERROR_RESPONSE}:${JSON.stringify(
2424
+ {
2425
+ status,
2426
+ statusText,
2427
+ data: data2
2428
+ }
2429
+ )}`;
2430
+ }
2431
+
2432
+ // lib/rsc/server.rsc.ts
2396
2433
  var Outlet = reactServerClient.Outlet;
2397
2434
  var WithComponentProps = reactServerClient.UNSAFE_WithComponentProps;
2398
2435
  var WithErrorBoundaryProps = reactServerClient.UNSAFE_WithErrorBoundaryProps;
@@ -2464,8 +2501,28 @@ async function matchRSCServerRequest({
2464
2501
  routes,
2465
2502
  generateResponse
2466
2503
  }) {
2467
- let requestUrl = new URL(request.url);
2504
+ let url = new URL(request.url);
2505
+ basename = basename || "/";
2506
+ let normalizedPath = url.pathname;
2507
+ if (stripBasename(normalizedPath, basename) === "/_root.rsc") {
2508
+ normalizedPath = basename;
2509
+ } else if (normalizedPath.endsWith(".rsc")) {
2510
+ normalizedPath = normalizedPath.replace(/\.rsc$/, "");
2511
+ }
2512
+ if (stripBasename(normalizedPath, basename) !== "/" && normalizedPath.endsWith("/")) {
2513
+ normalizedPath = normalizedPath.slice(0, -1);
2514
+ }
2515
+ url.pathname = normalizedPath;
2516
+ basename = basename.length > normalizedPath.length ? normalizedPath : basename;
2517
+ let routerRequest = new Request(url.toString(), {
2518
+ method: request.method,
2519
+ headers: request.headers,
2520
+ body: request.body,
2521
+ signal: request.signal,
2522
+ duplex: request.body ? "half" : void 0
2523
+ });
2468
2524
  const temporaryReferences = createTemporaryReferenceSet();
2525
+ const requestUrl = new URL(request.url);
2469
2526
  if (isManifestRequest(requestUrl)) {
2470
2527
  let response2 = await generateManifestResponse(
2471
2528
  routes,
@@ -2477,18 +2534,6 @@ async function matchRSCServerRequest({
2477
2534
  return response2;
2478
2535
  }
2479
2536
  let isDataRequest = isReactServerRequest(requestUrl);
2480
- const url = new URL(request.url);
2481
- let routerRequest = request;
2482
- if (isDataRequest) {
2483
- url.pathname = url.pathname.replace(/(_root)?\.rsc$/, "");
2484
- routerRequest = new Request(url.toString(), {
2485
- method: request.method,
2486
- headers: request.headers,
2487
- body: request.body,
2488
- signal: request.signal,
2489
- duplex: request.body ? "half" : void 0
2490
- });
2491
- }
2492
2537
  let matches = matchRoutes(routes, url.pathname, basename);
2493
2538
  if (matches) {
2494
2539
  await Promise.all(matches.map((m) => explodeLazyRoute(m.route)));
@@ -2560,7 +2605,7 @@ async function generateManifestResponse(routes, basename, request, generateRespo
2560
2605
  }),
2561
2606
  payload
2562
2607
  },
2563
- { temporaryReferences }
2608
+ { temporaryReferences, onError: defaultOnError }
2564
2609
  );
2565
2610
  }
2566
2611
  function prependBasenameToRedirectResponse(response, basename = "/") {
@@ -2838,7 +2883,7 @@ function generateRedirectResponse(response, actionResult, basename, isDataReques
2838
2883
  headers,
2839
2884
  payload
2840
2885
  },
2841
- { temporaryReferences }
2886
+ { temporaryReferences, onError: defaultOnError }
2842
2887
  );
2843
2888
  }
2844
2889
  async function generateStaticContextResponse(routes, basename, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, formState, staticContext, temporaryReferences, skipRevalidation, sideEffectRedirectHeaders) {
@@ -2868,7 +2913,7 @@ async function generateStaticContextResponse(routes, basename, generateResponse,
2868
2913
  headers.delete("Content-Length");
2869
2914
  const baseRenderPayload = {
2870
2915
  type: "render",
2871
- basename,
2916
+ basename: staticContext.basename,
2872
2917
  actionData: staticContext.actionData,
2873
2918
  errors: staticContext.errors,
2874
2919
  loaderData: staticContext.loaderData,
@@ -2905,7 +2950,7 @@ async function generateStaticContextResponse(routes, basename, generateResponse,
2905
2950
  headers,
2906
2951
  payload
2907
2952
  },
2908
- { temporaryReferences }
2953
+ { temporaryReferences, onError: defaultOnError }
2909
2954
  );
2910
2955
  }
2911
2956
  async function getRenderPayload(baseRenderPayload, routes, basename, routeIdsToLoad, isDataRequest, staticContext) {
@@ -3116,6 +3161,14 @@ function isReactServerRequest(url) {
3116
3161
  function isManifestRequest(url) {
3117
3162
  return url.pathname.endsWith(".manifest");
3118
3163
  }
3164
+ function defaultOnError(error) {
3165
+ if (isRedirectResponse(error)) {
3166
+ return createRedirectErrorDigest(error);
3167
+ }
3168
+ if (isResponse(error) || isDataWithResponseInit(error)) {
3169
+ return createRouteErrorResponseDigest(error);
3170
+ }
3171
+ }
3119
3172
  function isClientReference(x) {
3120
3173
  try {
3121
3174
  return x.$$typeof === Symbol.for("react.client.reference");