react-router 8.4.0 → 8.5.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 (233) hide show
  1. package/CHANGELOG.md +94 -1
  2. package/dist/development/dom-export.d.ts +2 -1
  3. package/dist/development/dom-export.js +1 -1
  4. package/dist/development/index-react-server-client.js +2 -2
  5. package/dist/development/index-react-server.d.ts +237 -165
  6. package/dist/development/index-react-server.js +69 -33
  7. package/dist/development/index.d.ts +9 -8
  8. package/dist/development/index.js +5 -4
  9. package/dist/development/lib/actions.js +1 -1
  10. package/dist/development/lib/await.js +58 -0
  11. package/dist/development/lib/components.d.ts +41 -5
  12. package/dist/development/lib/components.js +82 -5
  13. package/dist/development/lib/context.d.ts +8 -3
  14. package/dist/development/lib/context.js +1 -1
  15. package/dist/development/lib/dom/dom.d.ts +3 -0
  16. package/dist/development/lib/dom/dom.js +1 -1
  17. package/dist/development/lib/dom/lib.d.ts +34 -9
  18. package/dist/development/lib/dom/lib.js +17 -6
  19. package/dist/development/lib/dom/server.js +2 -2
  20. package/dist/development/lib/dom/ssr/components.js +12 -9
  21. package/dist/development/lib/dom/ssr/data.js +1 -1
  22. package/dist/development/lib/dom/ssr/entry.d.ts +9 -2
  23. package/dist/development/lib/dom/ssr/errorBoundaries.js +1 -1
  24. package/dist/development/lib/dom/ssr/fallback.js +1 -1
  25. package/dist/development/lib/dom/ssr/fog-of-war.d.ts +3 -2
  26. package/dist/development/lib/dom/ssr/fog-of-war.js +25 -13
  27. package/dist/development/lib/dom/ssr/hydration.js +1 -1
  28. package/dist/development/lib/dom/ssr/invariant.js +1 -1
  29. package/dist/development/lib/dom/ssr/links.js +1 -1
  30. package/dist/development/lib/dom/ssr/markup.js +1 -1
  31. package/dist/development/lib/dom/ssr/route-discovery.d.ts +120 -0
  32. package/dist/development/lib/dom/ssr/route-discovery.js +415 -0
  33. package/dist/development/lib/dom/ssr/routeModules.js +1 -1
  34. package/dist/development/lib/dom/ssr/routes-test-stub.js +2 -2
  35. package/dist/development/lib/dom/ssr/routes.d.ts +2 -2
  36. package/dist/development/lib/dom/ssr/routes.js +8 -8
  37. package/dist/development/lib/dom/ssr/server.js +3 -1
  38. package/dist/development/lib/dom/ssr/single-fetch.d.ts +28 -2
  39. package/dist/development/lib/dom/ssr/single-fetch.js +73 -55
  40. package/dist/development/lib/dom-export/dom-router-provider.js +1 -1
  41. package/dist/development/lib/dom-export/hydrated-router.d.ts +28 -0
  42. package/dist/development/lib/dom-export/hydrated-router.js +32 -12
  43. package/dist/development/lib/errors.js +1 -1
  44. package/dist/development/lib/hooks.d.ts +3 -6
  45. package/dist/development/lib/hooks.js +8 -9
  46. package/dist/development/lib/href.js +1 -1
  47. package/dist/development/lib/router/history.js +1 -1
  48. package/dist/development/lib/router/instrumentation.js +1 -1
  49. package/dist/development/lib/router/matcher-route-pattern.js +1 -1
  50. package/dist/development/lib/router/matcher-route-pattern.preload.js +1 -1
  51. package/dist/development/lib/router/matcher.js +6 -1
  52. package/dist/development/lib/router/navigation.js +1 -1
  53. package/dist/development/lib/router/router.d.ts +8 -0
  54. package/dist/development/lib/router/router.js +213 -91
  55. package/dist/development/lib/router/url.js +1 -1
  56. package/dist/development/lib/router/utils.d.ts +31 -4
  57. package/dist/development/lib/router/utils.js +4 -3
  58. package/dist/development/lib/rsc/browser.js +4 -4
  59. package/dist/development/lib/rsc/errorBoundaries.js +1 -1
  60. package/dist/development/lib/rsc/html-stream/browser.js +1 -1
  61. package/dist/development/lib/rsc/html-stream/server.js +24 -12
  62. package/dist/development/lib/rsc/route-modules.js +1 -1
  63. package/dist/development/lib/rsc/server.rsc.d.ts +3 -2
  64. package/dist/development/lib/rsc/server.ssr.js +1 -1
  65. package/dist/development/lib/server-runtime/build.d.ts +14 -0
  66. package/dist/development/lib/server-runtime/cookies.js +1 -1
  67. package/dist/development/lib/server-runtime/crypto.js +1 -1
  68. package/dist/development/lib/server-runtime/data.js +1 -1
  69. package/dist/development/lib/server-runtime/dev.js +1 -1
  70. package/dist/development/lib/server-runtime/entry.js +1 -1
  71. package/dist/development/lib/server-runtime/errors.js +1 -1
  72. package/dist/development/lib/server-runtime/headers.js +1 -1
  73. package/dist/development/lib/server-runtime/invariant.js +1 -1
  74. package/dist/development/lib/server-runtime/mode.js +1 -1
  75. package/dist/development/lib/server-runtime/routeMatching.js +1 -1
  76. package/dist/development/lib/server-runtime/routes.d.ts +1 -1
  77. package/dist/development/lib/server-runtime/routes.js +1 -1
  78. package/dist/development/lib/server-runtime/server.js +24 -8
  79. package/dist/development/lib/server-runtime/serverHandoff.d.ts +17 -0
  80. package/dist/development/lib/server-runtime/serverHandoff.js +1 -1
  81. package/dist/development/lib/server-runtime/sessions/cookieStorage.js +1 -1
  82. package/dist/development/lib/server-runtime/sessions/memoryStorage.js +1 -1
  83. package/dist/development/lib/server-runtime/sessions.js +2 -2
  84. package/dist/development/lib/server-runtime/single-fetch.js +1 -1
  85. package/dist/development/lib/server-runtime/urls.js +1 -1
  86. package/dist/development/lib/server-runtime/warnings.js +1 -1
  87. package/dist/development/lib/types/internal.js +1 -1
  88. package/dist/development/lib/types/route-data.d.ts +2 -2
  89. package/dist/development/lib/types/route-module-annotations.d.ts +1 -1
  90. package/dist/development/route-pattern.js +1 -1
  91. package/dist/development/vendor/turbo-stream-v2/flatten.js +1 -1
  92. package/dist/development/vendor/turbo-stream-v2/turbo-stream.js +1 -1
  93. package/dist/development/vendor/turbo-stream-v2/unflatten.js +23 -3
  94. package/dist/development/vendor/turbo-stream-v2/utils.js +1 -1
  95. package/dist/production/dom-export.d.ts +2 -1
  96. package/dist/production/dom-export.js +1 -1
  97. package/dist/production/index-react-server-client.js +2 -2
  98. package/dist/production/index-react-server.d.ts +237 -165
  99. package/dist/production/index-react-server.js +69 -33
  100. package/dist/production/index.d.ts +9 -8
  101. package/dist/production/index.js +5 -4
  102. package/dist/production/lib/actions.js +1 -1
  103. package/dist/production/lib/await.js +58 -0
  104. package/dist/production/lib/components.d.ts +41 -5
  105. package/dist/production/lib/components.js +82 -5
  106. package/dist/production/lib/context.d.ts +8 -3
  107. package/dist/production/lib/context.js +1 -1
  108. package/dist/production/lib/dom/dom.d.ts +3 -0
  109. package/dist/production/lib/dom/dom.js +1 -1
  110. package/dist/production/lib/dom/lib.d.ts +34 -9
  111. package/dist/production/lib/dom/lib.js +17 -6
  112. package/dist/production/lib/dom/server.js +2 -2
  113. package/dist/production/lib/dom/ssr/components.js +12 -9
  114. package/dist/production/lib/dom/ssr/data.js +1 -1
  115. package/dist/production/lib/dom/ssr/entry.d.ts +9 -2
  116. package/dist/production/lib/dom/ssr/errorBoundaries.js +1 -1
  117. package/dist/production/lib/dom/ssr/fallback.js +1 -1
  118. package/dist/production/lib/dom/ssr/fog-of-war.d.ts +3 -2
  119. package/dist/production/lib/dom/ssr/fog-of-war.js +25 -13
  120. package/dist/production/lib/dom/ssr/hydration.js +1 -1
  121. package/dist/production/lib/dom/ssr/invariant.js +1 -1
  122. package/dist/production/lib/dom/ssr/links.js +1 -1
  123. package/dist/production/lib/dom/ssr/markup.js +1 -1
  124. package/dist/production/lib/dom/ssr/route-discovery.d.ts +120 -0
  125. package/dist/production/lib/dom/ssr/route-discovery.js +415 -0
  126. package/dist/production/lib/dom/ssr/routeModules.js +1 -1
  127. package/dist/production/lib/dom/ssr/routes-test-stub.js +2 -2
  128. package/dist/production/lib/dom/ssr/routes.d.ts +2 -2
  129. package/dist/production/lib/dom/ssr/routes.js +8 -8
  130. package/dist/production/lib/dom/ssr/server.js +3 -1
  131. package/dist/production/lib/dom/ssr/single-fetch.d.ts +28 -2
  132. package/dist/production/lib/dom/ssr/single-fetch.js +73 -55
  133. package/dist/production/lib/dom-export/dom-router-provider.js +1 -1
  134. package/dist/production/lib/dom-export/hydrated-router.d.ts +28 -0
  135. package/dist/production/lib/dom-export/hydrated-router.js +32 -12
  136. package/dist/production/lib/errors.js +1 -1
  137. package/dist/production/lib/hooks.d.ts +3 -6
  138. package/dist/production/lib/hooks.js +7 -8
  139. package/dist/production/lib/href.js +1 -1
  140. package/dist/production/lib/router/history.js +1 -1
  141. package/dist/production/lib/router/instrumentation.js +1 -1
  142. package/dist/production/lib/router/matcher-route-pattern.js +1 -1
  143. package/dist/production/lib/router/matcher-route-pattern.preload.js +1 -1
  144. package/dist/production/lib/router/matcher.js +6 -1
  145. package/dist/production/lib/router/navigation.js +1 -1
  146. package/dist/production/lib/router/router.d.ts +8 -0
  147. package/dist/production/lib/router/router.js +213 -91
  148. package/dist/production/lib/router/url.js +1 -1
  149. package/dist/production/lib/router/utils.d.ts +31 -4
  150. package/dist/production/lib/router/utils.js +4 -3
  151. package/dist/production/lib/rsc/browser.js +4 -4
  152. package/dist/production/lib/rsc/errorBoundaries.js +1 -1
  153. package/dist/production/lib/rsc/html-stream/browser.js +1 -1
  154. package/dist/production/lib/rsc/html-stream/server.js +24 -12
  155. package/dist/production/lib/rsc/route-modules.js +1 -1
  156. package/dist/production/lib/rsc/server.rsc.d.ts +3 -2
  157. package/dist/production/lib/rsc/server.ssr.js +1 -1
  158. package/dist/production/lib/server-runtime/build.d.ts +14 -0
  159. package/dist/production/lib/server-runtime/cookies.js +1 -1
  160. package/dist/production/lib/server-runtime/crypto.js +1 -1
  161. package/dist/production/lib/server-runtime/data.js +1 -1
  162. package/dist/production/lib/server-runtime/dev.js +1 -1
  163. package/dist/production/lib/server-runtime/entry.js +1 -1
  164. package/dist/production/lib/server-runtime/errors.js +1 -1
  165. package/dist/production/lib/server-runtime/headers.js +1 -1
  166. package/dist/production/lib/server-runtime/invariant.js +1 -1
  167. package/dist/production/lib/server-runtime/mode.js +1 -1
  168. package/dist/production/lib/server-runtime/routeMatching.js +1 -1
  169. package/dist/production/lib/server-runtime/routes.d.ts +1 -1
  170. package/dist/production/lib/server-runtime/routes.js +1 -1
  171. package/dist/production/lib/server-runtime/server.js +24 -8
  172. package/dist/production/lib/server-runtime/serverHandoff.d.ts +17 -0
  173. package/dist/production/lib/server-runtime/serverHandoff.js +1 -1
  174. package/dist/production/lib/server-runtime/sessions/cookieStorage.js +1 -1
  175. package/dist/production/lib/server-runtime/sessions/memoryStorage.js +1 -1
  176. package/dist/production/lib/server-runtime/sessions.js +2 -2
  177. package/dist/production/lib/server-runtime/single-fetch.js +1 -1
  178. package/dist/production/lib/server-runtime/urls.js +1 -1
  179. package/dist/production/lib/server-runtime/warnings.js +1 -1
  180. package/dist/production/lib/types/internal.js +1 -1
  181. package/dist/production/lib/types/route-data.d.ts +2 -2
  182. package/dist/production/lib/types/route-module-annotations.d.ts +1 -1
  183. package/dist/production/route-pattern.js +1 -1
  184. package/dist/production/vendor/turbo-stream-v2/flatten.js +1 -1
  185. package/dist/production/vendor/turbo-stream-v2/turbo-stream.js +1 -1
  186. package/dist/production/vendor/turbo-stream-v2/unflatten.js +23 -3
  187. package/dist/production/vendor/turbo-stream-v2/utils.js +1 -1
  188. package/docs/explanation/backend-for-frontend.md +0 -3
  189. package/docs/explanation/code-splitting.md +0 -3
  190. package/docs/explanation/concurrency.md +0 -3
  191. package/docs/explanation/hot-module-replacement.md +0 -3
  192. package/docs/explanation/lazy-route-discovery.md +4 -3
  193. package/docs/explanation/progressive-enhancement.md +0 -3
  194. package/docs/explanation/race-conditions.md +0 -3
  195. package/docs/explanation/react-transitions.md +0 -3
  196. package/docs/explanation/sessions-and-cookies.md +109 -5
  197. package/docs/explanation/state-management.md +0 -3
  198. package/docs/explanation/styling.md +0 -3
  199. package/docs/explanation/type-safety.md +0 -3
  200. package/docs/how-to/accessibility.md +0 -6
  201. package/docs/how-to/client-data.md +0 -3
  202. package/docs/how-to/custom-fetch.md +218 -0
  203. package/docs/how-to/data-strategy.md +23 -4
  204. package/docs/how-to/error-boundary.md +0 -3
  205. package/docs/how-to/error-reporting.md +0 -3
  206. package/docs/how-to/fetchers.md +0 -3
  207. package/docs/how-to/file-route-conventions.md +0 -3
  208. package/docs/how-to/file-uploads.md +0 -3
  209. package/docs/how-to/form-validation.md +0 -3
  210. package/docs/how-to/headers.md +0 -3
  211. package/docs/how-to/instrumentation.md +0 -3
  212. package/docs/how-to/middleware.md +7 -3
  213. package/docs/how-to/navigation-blocking.md +0 -3
  214. package/docs/how-to/optimize-revalidation.md +2 -5
  215. package/docs/how-to/pre-rendering.md +23 -4
  216. package/docs/how-to/presets.md +0 -3
  217. package/docs/how-to/react-server-components.md +0 -3
  218. package/docs/how-to/resource-routes.md +0 -3
  219. package/docs/how-to/route-discovery.md +147 -0
  220. package/docs/how-to/route-module-type-safety.md +0 -3
  221. package/docs/how-to/security.md +0 -3
  222. package/docs/how-to/server-bundles.md +0 -3
  223. package/docs/how-to/spa.md +2 -3
  224. package/docs/how-to/status.md +0 -3
  225. package/docs/how-to/suspense.md +22 -6
  226. package/docs/how-to/using-handle.md +0 -3
  227. package/docs/how-to/view-transitions.md +79 -15
  228. package/docs/start/framework/data-loading.md +9 -0
  229. package/docs/start/framework/navigating.md +5 -9
  230. package/docs/start/framework/rendering.md +37 -0
  231. package/docs/upgrading/future.md +0 -12
  232. package/docs/upgrading/v7.md +3 -33
  233. package/package.json +9 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,98 @@
1
1
  # `react-router`
2
2
 
3
+ ## v8.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix `URIError: URI malformed` when an API-only (`ssr: "unstable_api-only"`) server or an `ssr: false` dev server receives a URL path with a malformed percent-encoding ([#15649](https://github.com/remix-run/react-router/pull/15649))
8
+ - Bound server route manifest processing for paths with expensive route expansion ([#15703](https://github.com/remix-run/react-router/pull/15703))
9
+ - Fall back to initial route discovery during server rendering and RSC document/data requests
10
+ - Account for the number and depth of candidate branches when using regex matching
11
+ - Encode commas within paths sent to the lazy route discovery manifest endpoint so routes with commas in their paths are discovered correctly ([#15640](https://github.com/remix-run/react-router/pull/15640))
12
+ - Fix fetcher revalidation errors bubbling to the root error boundary instead of the nearest boundary above the route that owns the fetcher ([#15676](https://github.com/remix-run/react-router/pull/15676))
13
+ - Avoid duplicate history entries when posting a `<Form>` to the current URL with an encoded `action` ([#15679](https://github.com/remix-run/react-router/pull/15679))
14
+ - Replace the current history entry when the `action` contains characters that get percent-encoded, such as spaces or non-ASCII characters
15
+ - Fix an unhandled promise rejection when the browser skips a `viewTransition` navigation, for example in a hidden tab ([#15582](https://github.com/remix-run/react-router/pull/15582))
16
+ - Bubble rejected `lazy.Component` imports on loader-less routes to the nearest error boundary ([#15658](https://github.com/remix-run/react-router/pull/15658))
17
+ - Render the error boundary instead of a blank page
18
+ - Preserve pending fetcher mutation revalidation when an older navigation or background reload completes to prevent stale loader data ([#15686](https://github.com/remix-run/react-router/pull/15686))
19
+ - Keep newer fetcher loads cancellable and preserve them when earlier revalidations finish or abort, preventing older responses from overwriting fresh fetcher data
20
+ - Retry rejected `lazy` route imports instead of caching failures permanently ([#15689](https://github.com/remix-run/react-router/pull/15689))
21
+ - Revalidate loader data when a fetcher action redirect is not followed ([#15557](https://github.com/remix-run/react-router/pull/15557))
22
+ - Revalidate when an action redirect is ignored because a newer navigation started or the fetcher unmounted while the action was running
23
+ - Include shared parent loaders when another navigation completed while the action was running
24
+ - Continue to respect `shouldRevalidate`
25
+ - Return fetchers to `idle` when a revalidation completes a pending navigation started by another fetcher's redirect
26
+ - Avoid adding an incompatible `document.startViewTransition()` overload to the global `Document` type ([#15680](https://github.com/remix-run/react-router/pull/15680))
27
+ - Allow transition results to be assigned to the DOM `ViewTransition` type
28
+ - Fix duplicate headers when throwing a redirect from an RSC server function ([#15667](https://github.com/remix-run/react-router/pull/15667))
29
+ - Skip `deleteData` in `destroySession` when the session has no ID ([#15639](https://github.com/remix-run/react-router/pull/15639))
30
+ - Avoid failures when destroying a session without a cookie on storage that rejects an empty key
31
+ - Surface the host's 404 response when a SPA fallback route has no prerendered data ([#15646](https://github.com/remix-run/react-router/pull/15646))
32
+ - Request single-fetch `.data` files for hydrating routes with a server `loader` in an `ssr: false` app with a `prerender` config
33
+ - Avoid the internal "No result found for routeId" error for non-prerendered parameterized paths served via the SPA fallback
34
+ - Improve turbo-stream decoding validation and object property handling ([18e1fbd](https://github.com/remix-run/react-router/commit/18e1fbd))
35
+
36
+ ### Unstable Changes
37
+
38
+ ⚠️ _[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use_
39
+
40
+ - Add an opt-in `<Await unstable_promise={promise}>` implementation based on React's `use()` API ([#15678](https://github.com/remix-run/react-router/pull/15678))
41
+ - Use `React.use` instead of React Router's internal promise tracking
42
+ - Accept promise-like values and retain `errorElement`, `useAsyncValue`, and `useAsyncError` support
43
+ - Handle only promise rejections with `errorElement` when using `unstable_promise`, allowing child render errors to bubble to the nearest React error boundary
44
+ - Track streamed promises during decoding so settled server content stays visible during hydration updates with either Await API or direct `React.use()`
45
+
46
+ ## v8.5.0
47
+
48
+ ### Minor Changes
49
+
50
+ - Deprecate React Router's view transition APIs in favor of React's `<ViewTransition>` component, available in React 19.3 and later ([#15493](https://github.com/remix-run/react-router/pull/15493))
51
+ - Deprecate the `viewTransition` props/options, `useViewTransitionState`, and `NavLink`'s `isTransitioning` render prop and `transitioning` class
52
+ - Preserve existing behavior, including support for older React versions
53
+ - See the [migration guide](https://reactrouter.com/how-to/view-transitions) for a navigation example and compatibility considerations
54
+
55
+ ### Patch Changes
56
+
57
+ - Fix `<Await>` failing to server render promises decoded from an RSC payload, which caused the Suspense boundary to switch to client rendering ([#15597](https://github.com/remix-run/react-router/pull/15597))
58
+ - Declare `@types/react` and `@types/react-dom` as optional peer dependencies so the shipped type definitions resolve React types under strict (non-hoisted) node_modules layouts ([#15528](https://github.com/remix-run/react-router/pull/15528))
59
+ - Fix the `unstable_useRouterState` documentation example to call the imported alias ([#15535](https://github.com/remix-run/react-router/pull/15535))
60
+ - Render the `HydrateFallback` of a route discovered through `patchRoutesOnNavigation` during initial hydration ([#15537](https://github.com/remix-run/react-router/pull/15537))
61
+ - Routes discovered during initial hydration are now exposed in `state.matches` while their loaders run, so `<RouterProvider>` renders down to the discovered route's `HydrateFallback` instead of rendering nothing
62
+ - Fix router state recovery when updates occur before `RouterProvider` subscribes, including when other subscribers are already attached, and report current client errors once without replaying server errors during hydration ([#15637](https://github.com/remix-run/react-router/pull/15637))
63
+ - Fix `matchPath` not treating a static segment as optional when it contains characters outside `[\w-]` ([#15425](https://github.com/remix-run/react-router/pull/15425))
64
+ - Fix an RSC server crash when a client aborts a document request while the HTML stream waits for the RSC payload ([#15612](https://github.com/remix-run/react-router/pull/15612))
65
+ - Stop revalidating a fetcher after `fetcher.reset()`, so its cleared data no longer comes back on the next revalidation ([#15633](https://github.com/remix-run/react-router/pull/15633))
66
+
67
+ ### Unstable Changes
68
+
69
+ ⚠️ _[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use_
70
+
71
+ - Add an `unstable_fetch` prop to `<HydratedRouter>` to customize JavaScript-issued manifest and server data requests in conventional Framework Mode ([#15586](https://github.com/remix-run/react-router/pull/15586))
72
+ - The function receives the intended request as well as context identifying the type of request
73
+ - Data request context includes `navigationType` (`"PUSH"`, `"REPLACE"`, or `"POP"` for navigation-initiated requests, including reloaded fetchers; `null` otherwise)
74
+ - Data strategies receive equivalent metadata through `unstable_initiator` and `unstable_navigationType`
75
+ - The custom fetch context is a discriminated union, so narrowing `type` to `"navigation"` guarantees a non-null `navigationType`, while other data requests have a `null` `navigationType`
76
+ - Fetchers reloaded after an initialization redirect retain the `"initialization"` type and include their fetcher key
77
+ - Like other router initialization options, the implementation is captured when the singleton router is created and thus subsequent prop changes are ignored
78
+ - Browser-managed data prefetches from `<Link prefetch>` use native `<link rel="prefetch">` elements and do not call the custom implementation
79
+ - Use the callback for custom fetch options, custom headers, safe request retries, or response header inspection
80
+ - Return response bodies unchanged so React Router can decode its manifest and Turbo Stream data protocols
81
+ - Support API-only Framework Mode with runtime server data loading, actions, revalidation, and lazy route discovery ([#15601](https://github.com/remix-run/react-router/pull/15601))
82
+ - Hydrate prerendered pages from build-time data and fetch server loader data when hydrating a SPA fallback
83
+ - Preserve normal loader revalidation and server-action support for eagerly loaded and lazily discovered routes, and honor loader opt-outs when making server data requests
84
+ - Add `unstable_useRouteDiscovery` for application-controlled route discovery in conventional Framework Mode ([#15602](https://github.com/remix-run/react-router/pull/15602))
85
+ - Discover selected destinations or load the running client's full route manifest without loading route modules
86
+ - Compose manifest-mismatch handlers, with shared recovery and cancellation that preserves application state
87
+ - Keep full-manifest failures catchable without rendering error boundaries, whether mismatch handlers use the hook or event's `loadAllRoutes()`
88
+ - Cancel pending revalidation alongside a canceled navigation, retaining existing data and settling interrupted fetchers before restoring Back/Forward history
89
+ - Enable `future.unstable_customRouteDiscovery` to opt in
90
+ - Apps without the flag retain existing discovery behavior
91
+ - Call `event.defaultBehavior()` from a custom mismatch handler to explicitly run built-in recovery
92
+ - Return middleware short-circuit responses as-is for document requests in RSC modes, including resource routes, instead of decoding non-RSC bodies as Flight ([#15628](https://github.com/remix-run/react-router/pull/15628))
93
+ - Include server middleware in both eager and lazy RSC route configuration types
94
+ - Preserve HTML rendering for cached Flight responses returned by middleware, and pass through raw responses that replace the result of `next()`
95
+
3
96
  ## v8.4.0
4
97
 
5
98
  ### Minor Changes
@@ -25,7 +118,7 @@
25
118
 
26
119
  ### Unstable Changes
27
120
 
28
- ⚠️ _[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use_
121
+ ⚠️ _[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use_
29
122
 
30
123
  - Add a Data Mode `future.unstable_routePatternMatching` flag for more efficient route matching powered by `@remix-run/route-pattern` ([#15298](https://github.com/remix-run/react-router/pull/15298))
31
124
  - Add an `unstable_validateParams` route field to reject invalid parameter values and continue matching
@@ -1,7 +1,8 @@
1
1
 
2
2
  import { RouterProvider, RouterProviderProps } from "./lib/dom-export/dom-router-provider.js";
3
+ import { RouterFetch, RouterFetchContext } from "./lib/dom/ssr/single-fetch.js";
3
4
  import { DecodeActionFunction, DecodeFormStateFunction, DecodeReplyFunction, RSCManifestPayload, RSCPayload, RSCRenderPayload } from "./lib/rsc/server.rsc.js";
4
5
  import { RSCHydratedRouter, createCallServer } from "./lib/rsc/browser.js";
5
6
  import { HydratedRouter, HydratedRouterProps } from "./lib/dom-export/hydrated-router.js";
6
7
  import { getRSCStream } from "./lib/rsc/html-stream/browser.js";
7
- export { HydratedRouter, type HydratedRouterProps, RouterProvider, type RouterProviderProps, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, RSCHydratedRouter as unstable_RSCHydratedRouter, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, createCallServer as unstable_createCallServer, getRSCStream as unstable_getRSCStream };
8
+ export { HydratedRouter, type HydratedRouterProps, RouterProvider, type RouterProviderProps, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, RSCHydratedRouter as unstable_RSCHydratedRouter, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, type RouterFetch as unstable_RouterFetch, type RouterFetchContext as unstable_RouterFetchContext, createCallServer as unstable_createCallServer, getRSCStream as unstable_getRSCStream };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v8.4.0
2
+ * react-router v8.5.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v8.4.0
2
+ * react-router v8.5.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -10,8 +10,8 @@
10
10
  */
11
11
  "use client";
12
12
  import { AwaitContextProvider } from "./lib/context.js";
13
- import { MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, WithComponentProps, WithErrorBoundaryProps, WithHydrateFallbackProps } from "./lib/components.js";
14
13
  import { Links, Meta } from "./lib/dom/ssr/components.js";
14
+ import { MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, WithComponentProps, WithErrorBoundaryProps, WithHydrateFallbackProps } from "./lib/components.js";
15
15
  import { BrowserRouter, Form, HashRouter, HistoryRouter, Link, NavLink, ScrollRestoration } from "./lib/dom/lib.js";
16
16
  import { StaticRouter, StaticRouterProvider } from "./lib/dom/server.js";
17
17
  export { BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta, NavLink, Navigate, Outlet, Route, Router, RouterProvider, Routes, ScrollRestoration, StaticRouter, StaticRouterProvider, AwaitContextProvider as UNSAFE_AwaitContextProvider, WithComponentProps as UNSAFE_WithComponentProps, WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps, WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps, HistoryRouter as unstable_HistoryRouter };
@@ -352,6 +352,13 @@ interface DataFunctionArgs<Context> {
352
352
  * In Framework mode, this is a normalized URL with React-Router-specific
353
353
  * implementation details removed (`.data` suffixes, `index`/`_routes` search
354
354
  * params). For the raw incoming URL, use `request.url`.
355
+ *
356
+ * This normalization preserves standard URL pathname encoding and casing.
357
+ * For example, a request to `/%61dmin.data` produces a `url.pathname` of
358
+ * `/%61dmin`. This is not a canonical representation of the matched route.
359
+ * For authorization, attach {@link https://reactrouter.com/how-to/middleware#authentication server middleware}
360
+ * to the protected route or a common ancestor instead of relying on literal
361
+ * pathname-prefix comparisons.
355
362
  */
356
363
  url: URL;
357
364
  /**
@@ -556,6 +563,11 @@ interface DataStrategyMatch extends RouteMatch<string, DataRouteObject> {
556
563
  */
557
564
  resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<DataStrategyResult>;
558
565
  }
566
+ /**
567
+ * The operation that initiated a data strategy execution. Static handler
568
+ * executions use `"static"`.
569
+ */
570
+ type DataStrategyInitiator = "initialization" | "navigation" | "fetcher" | "revalidation" | "static";
559
571
  interface DataStrategyFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {
560
572
  /**
561
573
  * Matches for this route extended with Data strategy APIs
@@ -563,8 +575,23 @@ interface DataStrategyFunctionArgs<Context = DefaultContext> extends DataFunctio
563
575
  matches: DataStrategyMatch[];
564
576
  runClientMiddleware: (cb: DataStrategyFunction<Context>) => Promise<Record<string, DataStrategyResult>>;
565
577
  /**
566
- * The key of the fetcher we are calling `dataStrategy` for, otherwise `null`
567
- * for navigational executions
578
+ * The operation that initiated this data strategy execution
579
+ *
580
+ * This field is experimental and subject to breaking changes.
581
+ */
582
+ unstable_initiator: DataStrategyInitiator;
583
+ /**
584
+ * The history action (`"PUSH"`, `"REPLACE"`, or `"POP"`) for a navigation-
585
+ * initiated execution, including fetchers reloaded by that navigation.
586
+ * `null` for initialization, fetcher, revalidation, and static executions.
587
+ *
588
+ * This field is experimental and subject to breaking changes.
589
+ */
590
+ unstable_navigationType: Action | null;
591
+ /**
592
+ * The key of the fetcher targeted by this data strategy execution, otherwise
593
+ * `null`. Fetchers reloaded during a navigation or revalidation retain that
594
+ * `unstable_initiator` while providing their key here.
568
595
  */
569
596
  fetcherKey: string | null;
570
597
  }
@@ -979,6 +1006,204 @@ type ErrorResponse = {
979
1006
  */
980
1007
  declare function isRouteErrorResponse(error: any): error is ErrorResponse;
981
1008
  //#endregion
1009
+ //#region lib/components.d.ts
1010
+ interface AwaitResolveRenderFunction<Resolve = any> {
1011
+ (data: Awaited<Resolve>): React.ReactNode;
1012
+ }
1013
+ /**
1014
+ * @category Types
1015
+ */
1016
+ interface AwaitProps<Resolve> {
1017
+ /** Use either `resolve` or `unstable_promise`, never both. */
1018
+ unstable_promise?: never;
1019
+ /**
1020
+ * When using a function, the resolved value is provided as the parameter.
1021
+ *
1022
+ * ```tsx [2]
1023
+ * <Await resolve={reviewsPromise}>
1024
+ * {(resolvedReviews) => <Reviews items={resolvedReviews} />}
1025
+ * </Await>
1026
+ * ```
1027
+ *
1028
+ * When using React elements, {@link useAsyncValue} will provide the
1029
+ * resolved value:
1030
+ *
1031
+ * ```tsx [2]
1032
+ * <Await resolve={reviewsPromise}>
1033
+ * <Reviews />
1034
+ * </Await>
1035
+ *
1036
+ * function Reviews() {
1037
+ * const resolvedReviews = useAsyncValue();
1038
+ * return <div>...</div>;
1039
+ * }
1040
+ * ```
1041
+ */
1042
+ children: React.ReactNode | AwaitResolveRenderFunction<Resolve>;
1043
+ /**
1044
+ * The error element renders instead of the `children` when the [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
1045
+ * rejects.
1046
+ *
1047
+ * ```tsx
1048
+ * <Await
1049
+ * errorElement={<div>Oops</div>}
1050
+ * resolve={reviewsPromise}
1051
+ * >
1052
+ * <Reviews />
1053
+ * </Await>
1054
+ * ```
1055
+ *
1056
+ * To provide a more contextual error, you can use the {@link useAsyncError} in a
1057
+ * child component
1058
+ *
1059
+ * ```tsx
1060
+ * <Await
1061
+ * errorElement={<ReviewsError />}
1062
+ * resolve={reviewsPromise}
1063
+ * >
1064
+ * <Reviews />
1065
+ * </Await>
1066
+ *
1067
+ * function ReviewsError() {
1068
+ * const error = useAsyncError();
1069
+ * return <div>Error loading reviews: {error.message}</div>;
1070
+ * }
1071
+ * ```
1072
+ *
1073
+ * If you do not provide an `errorElement`, the rejected value will bubble up
1074
+ * to the nearest route-level [`ErrorBoundary`](../../start/framework/route-module#errorboundary)
1075
+ * and be accessible via the {@link useRouteError} hook.
1076
+ */
1077
+ errorElement?: React.ReactNode;
1078
+ /**
1079
+ * Takes a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
1080
+ * returned from a [`loader`](../../start/framework/route-module#loader) to be
1081
+ * resolved and rendered.
1082
+ *
1083
+ * ```tsx
1084
+ * import { Await, useLoaderData } from "react-router";
1085
+ *
1086
+ * export async function loader() {
1087
+ * let reviews = getReviews(); // not awaited
1088
+ * let book = await getBook();
1089
+ * return {
1090
+ * book,
1091
+ * reviews, // this is a promise
1092
+ * };
1093
+ * }
1094
+ *
1095
+ * export default function Book() {
1096
+ * const {
1097
+ * book,
1098
+ * reviews, // this is the same promise
1099
+ * } = useLoaderData();
1100
+ *
1101
+ * return (
1102
+ * <div>
1103
+ * <h1>{book.title}</h1>
1104
+ * <p>{book.description}</p>
1105
+ * <React.Suspense fallback={<ReviewsSkeleton />}>
1106
+ * <Await
1107
+ * // and is the promise we pass to Await
1108
+ * resolve={reviews}
1109
+ * >
1110
+ * <Reviews />
1111
+ * </Await>
1112
+ * </React.Suspense>
1113
+ * </div>
1114
+ * );
1115
+ * }
1116
+ * ```
1117
+ */
1118
+ resolve: Resolve;
1119
+ }
1120
+ interface AwaitPromiseProps<Resolve> extends Omit<AwaitProps<Resolve>, "resolve" | "unstable_promise"> {
1121
+ resolve?: never;
1122
+ /**
1123
+ * A promise (or value) to read using React's `use()` API in client components.
1124
+ * Unlike `resolve` in client components, this accepts promise-like values
1125
+ * without modifying the source promise.
1126
+ *
1127
+ * `errorElement` handles promise rejections. Errors thrown while rendering
1128
+ * children bubble to the nearest React error boundary.
1129
+ *
1130
+ * ```tsx
1131
+ * <Await unstable_promise={reviewsPromise} errorElement={<ReviewsError />}>
1132
+ * {(reviews) => <Reviews items={reviews} />}
1133
+ * </Await>
1134
+ * ```
1135
+ *
1136
+ * Pass exactly one of `unstable_promise` or `resolve`.
1137
+ */
1138
+ unstable_promise: Resolve;
1139
+ }
1140
+ /**
1141
+ * Used to render promise values with automatic error handling.
1142
+ *
1143
+ * **Note:** `<Await>` expects to be rendered inside a [`<React.Suspense>`](https://react.dev/reference/react/Suspense)
1144
+ *
1145
+ * Pass `unstable_promise` instead of `resolve` to opt into React's
1146
+ * [`use()`](https://react.dev/reference/react/use) implementation. With
1147
+ * `unstable_promise`, `errorElement` handles promise rejections, while errors
1148
+ * thrown by children bubble to the nearest React error boundary.
1149
+ *
1150
+ * In React Server Components, `resolve` already has this error-handling behavior:
1151
+ * `errorElement` handles only input rejections, while child render errors
1152
+ * propagate to the surrounding error boundary. Both props accept promise-like
1153
+ * values without modifying the source promise. Both props treat a falsy
1154
+ * `errorElement` as absent and propagate the rejection. Pass an empty fragment
1155
+ * to handle a rejection without rendering any content.
1156
+ *
1157
+ * <docs-warning>The `unstable_promise` prop is experimental and may change in
1158
+ * minor or patch releases.</docs-warning>
1159
+ *
1160
+ * @example
1161
+ * import { Await, useLoaderData } from "react-router";
1162
+ *
1163
+ * export async function loader() {
1164
+ * // not awaited
1165
+ * const reviews = getReviews();
1166
+ * // awaited (blocks the transition)
1167
+ * const book = await fetch("/api/book").then((res) => res.json());
1168
+ * return { book, reviews };
1169
+ * }
1170
+ *
1171
+ * function Book() {
1172
+ * const { book, reviews } = useLoaderData();
1173
+ * return (
1174
+ * <div>
1175
+ * <h1>{book.title}</h1>
1176
+ * <p>{book.description}</p>
1177
+ * <React.Suspense fallback={<ReviewsSkeleton />}>
1178
+ * <Await
1179
+ * resolve={reviews}
1180
+ * errorElement={
1181
+ * <div>Could not load reviews 😬</div>
1182
+ * }
1183
+ * children={(resolvedReviews) => (
1184
+ * <Reviews items={resolvedReviews} />
1185
+ * )}
1186
+ * />
1187
+ * </React.Suspense>
1188
+ * </div>
1189
+ * );
1190
+ * }
1191
+ *
1192
+ * @public
1193
+ * @category Components
1194
+ * @mode framework
1195
+ * @mode data
1196
+ * @param props Props
1197
+ * @param {AwaitProps.children} props.children n/a
1198
+ * @param {AwaitProps.errorElement} props.errorElement n/a
1199
+ * @param {AwaitProps.resolve} props.resolve n/a
1200
+ * @param props.unstable_promise A promise (or value) to read using React's `use()`
1201
+ * API in client components. Accepts promise-like values without modifying the
1202
+ * source promise. Pass exactly one of `unstable_promise` or `resolve`.
1203
+ * @returns React element for the rendered awaited value
1204
+ */
1205
+ declare function Await$1<Resolve>(props: AwaitProps<Resolve> | AwaitPromiseProps<Resolve>): React.JSX.Element;
1206
+ //#endregion
982
1207
  //#region lib/router/instrumentation.d.ts
983
1208
  type ServerInstrumentation = {
984
1209
  handler?: InstrumentRequestHandlerFunction;
@@ -1390,6 +1615,8 @@ type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "e
1390
1615
  * Future flags to toggle new feature behavior
1391
1616
  */
1392
1617
  interface FutureConfig {
1618
+ /** @internal Enables application-controlled Framework route discovery. */
1619
+ unstable_customRouteDiscovery?: boolean;
1393
1620
  /** Enables route-pattern matching after calling `unstable_preloadRoutePattern()`. */
1394
1621
  unstable_routePatternMatching?: boolean;
1395
1622
  }
@@ -1435,6 +1662,8 @@ interface StaticHandler {
1435
1662
  * The set of data routes managed by this handler
1436
1663
  */
1437
1664
  dataRoutes: DataRouteObject[];
1665
+ /** @private Estimated route metadata visits per regex match. */
1666
+ readonly _matchCost?: number;
1438
1667
  /**
1439
1668
  * @private
1440
1669
  * PRIVATE - DO NOT USE
@@ -1536,6 +1765,10 @@ type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
1536
1765
  replace?: boolean;
1537
1766
  state?: any;
1538
1767
  fromRouteId?: string;
1768
+ /**
1769
+ * @deprecated Use React's `<ViewTransition>` component instead. See the
1770
+ * [migration guide](https://reactrouter.com/how-to/view-transitions).
1771
+ */
1539
1772
  viewTransition?: boolean;
1540
1773
  mask?: To;
1541
1774
  };
@@ -2087,168 +2320,6 @@ type LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray;
2087
2320
  */
2088
2321
  type RouteHandle = unknown;
2089
2322
  //#endregion
2090
- //#region lib/components.d.ts
2091
- interface AwaitResolveRenderFunction<Resolve = any> {
2092
- (data: Awaited<Resolve>): React.ReactNode;
2093
- }
2094
- /**
2095
- * @category Types
2096
- */
2097
- interface AwaitProps<Resolve> {
2098
- /**
2099
- * When using a function, the resolved value is provided as the parameter.
2100
- *
2101
- * ```tsx [2]
2102
- * <Await resolve={reviewsPromise}>
2103
- * {(resolvedReviews) => <Reviews items={resolvedReviews} />}
2104
- * </Await>
2105
- * ```
2106
- *
2107
- * When using React elements, {@link useAsyncValue} will provide the
2108
- * resolved value:
2109
- *
2110
- * ```tsx [2]
2111
- * <Await resolve={reviewsPromise}>
2112
- * <Reviews />
2113
- * </Await>
2114
- *
2115
- * function Reviews() {
2116
- * const resolvedReviews = useAsyncValue();
2117
- * return <div>...</div>;
2118
- * }
2119
- * ```
2120
- */
2121
- children: React.ReactNode | AwaitResolveRenderFunction<Resolve>;
2122
- /**
2123
- * The error element renders instead of the `children` when the [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
2124
- * rejects.
2125
- *
2126
- * ```tsx
2127
- * <Await
2128
- * errorElement={<div>Oops</div>}
2129
- * resolve={reviewsPromise}
2130
- * >
2131
- * <Reviews />
2132
- * </Await>
2133
- * ```
2134
- *
2135
- * To provide a more contextual error, you can use the {@link useAsyncError} in a
2136
- * child component
2137
- *
2138
- * ```tsx
2139
- * <Await
2140
- * errorElement={<ReviewsError />}
2141
- * resolve={reviewsPromise}
2142
- * >
2143
- * <Reviews />
2144
- * </Await>
2145
- *
2146
- * function ReviewsError() {
2147
- * const error = useAsyncError();
2148
- * return <div>Error loading reviews: {error.message}</div>;
2149
- * }
2150
- * ```
2151
- *
2152
- * If you do not provide an `errorElement`, the rejected value will bubble up
2153
- * to the nearest route-level [`ErrorBoundary`](../../start/framework/route-module#errorboundary)
2154
- * and be accessible via the {@link useRouteError} hook.
2155
- */
2156
- errorElement?: React.ReactNode;
2157
- /**
2158
- * Takes a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
2159
- * returned from a [`loader`](../../start/framework/route-module#loader) to be
2160
- * resolved and rendered.
2161
- *
2162
- * ```tsx
2163
- * import { Await, useLoaderData } from "react-router";
2164
- *
2165
- * export async function loader() {
2166
- * let reviews = getReviews(); // not awaited
2167
- * let book = await getBook();
2168
- * return {
2169
- * book,
2170
- * reviews, // this is a promise
2171
- * };
2172
- * }
2173
- *
2174
- * export default function Book() {
2175
- * const {
2176
- * book,
2177
- * reviews, // this is the same promise
2178
- * } = useLoaderData();
2179
- *
2180
- * return (
2181
- * <div>
2182
- * <h1>{book.title}</h1>
2183
- * <p>{book.description}</p>
2184
- * <React.Suspense fallback={<ReviewsSkeleton />}>
2185
- * <Await
2186
- * // and is the promise we pass to Await
2187
- * resolve={reviews}
2188
- * >
2189
- * <Reviews />
2190
- * </Await>
2191
- * </React.Suspense>
2192
- * </div>
2193
- * );
2194
- * }
2195
- * ```
2196
- */
2197
- resolve: Resolve;
2198
- }
2199
- /**
2200
- * Used to render promise values with automatic error handling.
2201
- *
2202
- * **Note:** `<Await>` expects to be rendered inside a [`<React.Suspense>`](https://react.dev/reference/react/Suspense)
2203
- *
2204
- * @example
2205
- * import { Await, useLoaderData } from "react-router";
2206
- *
2207
- * export async function loader() {
2208
- * // not awaited
2209
- * const reviews = getReviews();
2210
- * // awaited (blocks the transition)
2211
- * const book = await fetch("/api/book").then((res) => res.json());
2212
- * return { book, reviews };
2213
- * }
2214
- *
2215
- * function Book() {
2216
- * const { book, reviews } = useLoaderData();
2217
- * return (
2218
- * <div>
2219
- * <h1>{book.title}</h1>
2220
- * <p>{book.description}</p>
2221
- * <React.Suspense fallback={<ReviewsSkeleton />}>
2222
- * <Await
2223
- * resolve={reviews}
2224
- * errorElement={
2225
- * <div>Could not load reviews 😬</div>
2226
- * }
2227
- * children={(resolvedReviews) => (
2228
- * <Reviews items={resolvedReviews} />
2229
- * )}
2230
- * />
2231
- * </React.Suspense>
2232
- * </div>
2233
- * );
2234
- * }
2235
- *
2236
- * @public
2237
- * @category Components
2238
- * @mode framework
2239
- * @mode data
2240
- * @param props Props
2241
- * @param {AwaitProps.children} props.children n/a
2242
- * @param {AwaitProps.errorElement} props.errorElement n/a
2243
- * @param {AwaitProps.resolve} props.resolve n/a
2244
- * @returns React element for the rendered awaited value
2245
- */
2246
- declare function Await$1<Resolve>({
2247
- children,
2248
- errorElement,
2249
- resolve
2250
- }: AwaitProps<Resolve>): React.JSX.Element;
2251
- //#endregion
2252
2323
  //#region lib/rsc/server.rsc.d.ts
2253
2324
  declare function getRequest(): Request;
2254
2325
  declare const redirect: typeof redirect$1;
@@ -2267,6 +2338,7 @@ type RSCRouteConfigEntryBase = {
2267
2338
  links?: LinksFunction;
2268
2339
  loader?: LoaderFunction;
2269
2340
  meta?: MetaFunction;
2341
+ middleware?: MiddlewareFunction<any>[];
2270
2342
  shouldRevalidate?: ShouldRevalidateFunction;
2271
2343
  };
2272
2344
  type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
@@ -2452,7 +2524,7 @@ declare function matchRSCServerRequest({
2452
2524
  onError,
2453
2525
  request,
2454
2526
  routes,
2455
- generateResponse
2527
+ generateResponse: encodeResponse
2456
2528
  }: {
2457
2529
  allowedActionOrigins?: string[];
2458
2530
  createTemporaryReferenceSet: () => unknown;