react-router 8.5.0 → 8.5.2

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 (214) hide show
  1. package/CHANGELOG.md +70 -1
  2. package/dist/development/dom-export.js +1 -1
  3. package/dist/development/index-react-server-client.js +1 -1
  4. package/dist/development/index-react-server.d.ts +75 -415
  5. package/dist/development/index-react-server.js +106 -20
  6. package/dist/development/index.js +1 -1
  7. package/dist/development/lib/actions.js +1 -1
  8. package/dist/development/lib/await.js +58 -0
  9. package/dist/development/lib/components.d.ts +65 -25
  10. package/dist/development/lib/components.js +69 -15
  11. package/dist/development/lib/context.d.ts +2 -2
  12. package/dist/development/lib/context.js +1 -1
  13. package/dist/development/lib/dom/dom.js +13 -4
  14. package/dist/development/lib/dom/lib.d.ts +2 -2
  15. package/dist/development/lib/dom/lib.js +11 -4
  16. package/dist/development/lib/dom/server.js +1 -1
  17. package/dist/development/lib/dom/ssr/components.js +1 -1
  18. package/dist/development/lib/dom/ssr/data.js +1 -1
  19. package/dist/development/lib/dom/ssr/errorBoundaries.js +1 -1
  20. package/dist/development/lib/dom/ssr/fallback.js +1 -1
  21. package/dist/development/lib/dom/ssr/fog-of-war.js +12 -3
  22. package/dist/development/lib/dom/ssr/hydration.d.ts +1 -0
  23. package/dist/development/lib/dom/ssr/hydration.js +1 -1
  24. package/dist/development/lib/dom/ssr/invariant.js +1 -1
  25. package/dist/development/lib/dom/ssr/links.js +1 -1
  26. package/dist/development/lib/dom/ssr/markup.js +1 -1
  27. package/dist/development/lib/dom/ssr/route-discovery.d.ts +2 -2
  28. package/dist/development/lib/dom/ssr/route-discovery.js +3 -3
  29. package/dist/development/lib/dom/ssr/routeModules.js +1 -1
  30. package/dist/development/lib/dom/ssr/routes-test-stub.js +1 -1
  31. package/dist/development/lib/dom/ssr/routes.js +1 -1
  32. package/dist/development/lib/dom/ssr/server.js +1 -1
  33. package/dist/development/lib/dom/ssr/single-fetch.d.ts +1 -1
  34. package/dist/development/lib/dom/ssr/single-fetch.js +7 -7
  35. package/dist/development/lib/dom-export/dom-router-provider.js +1 -1
  36. package/dist/development/lib/dom-export/hydrated-router.d.ts +1 -1
  37. package/dist/development/lib/dom-export/hydrated-router.js +5 -3
  38. package/dist/development/lib/errors.js +1 -1
  39. package/dist/development/lib/hooks.d.ts +0 -3
  40. package/dist/development/lib/hooks.js +13 -9
  41. package/dist/development/lib/href.js +4 -4
  42. package/dist/development/lib/router/history.js +1 -1
  43. package/dist/development/lib/router/instrumentation.js +1 -1
  44. package/dist/development/lib/router/matcher-route-pattern.js +1 -1
  45. package/dist/development/lib/router/matcher-route-pattern.preload.js +1 -1
  46. package/dist/development/lib/router/matcher.js +6 -1
  47. package/dist/development/lib/router/navigation.js +17 -2
  48. package/dist/development/lib/router/router.d.ts +2 -0
  49. package/dist/development/lib/router/router.js +62 -29
  50. package/dist/development/lib/router/url.js +1 -1
  51. package/dist/development/lib/router/utils.d.ts +13 -5
  52. package/dist/development/lib/router/utils.js +17 -8
  53. package/dist/development/lib/rsc/browser.js +28 -5
  54. package/dist/development/lib/rsc/errorBoundaries.js +1 -1
  55. package/dist/development/lib/rsc/html-stream/browser.js +1 -1
  56. package/dist/development/lib/rsc/html-stream/server.js +1 -1
  57. package/dist/development/lib/rsc/route-modules.js +1 -1
  58. package/dist/development/lib/rsc/server.rsc.d.ts +2 -0
  59. package/dist/development/lib/rsc/server.ssr.js +1 -1
  60. package/dist/development/lib/server-runtime/cookies.js +1 -1
  61. package/dist/development/lib/server-runtime/crypto.js +1 -1
  62. package/dist/development/lib/server-runtime/data.js +1 -1
  63. package/dist/development/lib/server-runtime/dev.js +1 -1
  64. package/dist/development/lib/server-runtime/entry.js +1 -1
  65. package/dist/development/lib/server-runtime/errors.js +1 -1
  66. package/dist/development/lib/server-runtime/headers.js +1 -1
  67. package/dist/development/lib/server-runtime/invariant.js +1 -1
  68. package/dist/development/lib/server-runtime/mode.js +1 -1
  69. package/dist/development/lib/server-runtime/routeMatching.js +1 -1
  70. package/dist/development/lib/server-runtime/routes.js +1 -1
  71. package/dist/development/lib/server-runtime/server.js +21 -10
  72. package/dist/development/lib/server-runtime/serverHandoff.js +1 -1
  73. package/dist/development/lib/server-runtime/sessions/cookieStorage.js +1 -1
  74. package/dist/development/lib/server-runtime/sessions/memoryStorage.js +1 -1
  75. package/dist/development/lib/server-runtime/sessions.js +2 -2
  76. package/dist/development/lib/server-runtime/single-fetch.js +1 -1
  77. package/dist/development/lib/server-runtime/urls.js +1 -1
  78. package/dist/development/lib/server-runtime/warnings.js +1 -1
  79. package/dist/development/lib/types/internal.js +1 -1
  80. package/dist/development/lib/types/route-module-annotations.d.ts +1 -1
  81. package/dist/development/route-pattern.js +1 -1
  82. package/dist/development/vendor/turbo-stream-v2/flatten.js +1 -1
  83. package/dist/development/vendor/turbo-stream-v2/turbo-stream.js +75 -66
  84. package/dist/development/vendor/turbo-stream-v2/unflatten.js +23 -3
  85. package/dist/development/vendor/turbo-stream-v2/utils.js +1 -1
  86. package/dist/production/dom-export.js +1 -1
  87. package/dist/production/index-react-server-client.js +1 -1
  88. package/dist/production/index-react-server.d.ts +75 -415
  89. package/dist/production/index-react-server.js +106 -20
  90. package/dist/production/index.js +1 -1
  91. package/dist/production/lib/actions.js +1 -1
  92. package/dist/production/lib/await.js +58 -0
  93. package/dist/production/lib/components.d.ts +65 -25
  94. package/dist/production/lib/components.js +69 -15
  95. package/dist/production/lib/context.d.ts +2 -2
  96. package/dist/production/lib/context.js +1 -1
  97. package/dist/production/lib/dom/dom.js +13 -4
  98. package/dist/production/lib/dom/lib.d.ts +2 -2
  99. package/dist/production/lib/dom/lib.js +11 -4
  100. package/dist/production/lib/dom/server.js +1 -1
  101. package/dist/production/lib/dom/ssr/components.js +1 -1
  102. package/dist/production/lib/dom/ssr/data.js +1 -1
  103. package/dist/production/lib/dom/ssr/errorBoundaries.js +1 -1
  104. package/dist/production/lib/dom/ssr/fallback.js +1 -1
  105. package/dist/production/lib/dom/ssr/fog-of-war.js +12 -3
  106. package/dist/production/lib/dom/ssr/hydration.d.ts +1 -0
  107. package/dist/production/lib/dom/ssr/hydration.js +1 -1
  108. package/dist/production/lib/dom/ssr/invariant.js +1 -1
  109. package/dist/production/lib/dom/ssr/links.js +1 -1
  110. package/dist/production/lib/dom/ssr/markup.js +1 -1
  111. package/dist/production/lib/dom/ssr/route-discovery.d.ts +2 -2
  112. package/dist/production/lib/dom/ssr/route-discovery.js +3 -3
  113. package/dist/production/lib/dom/ssr/routeModules.js +1 -1
  114. package/dist/production/lib/dom/ssr/routes-test-stub.js +1 -1
  115. package/dist/production/lib/dom/ssr/routes.js +1 -1
  116. package/dist/production/lib/dom/ssr/server.js +1 -1
  117. package/dist/production/lib/dom/ssr/single-fetch.d.ts +1 -1
  118. package/dist/production/lib/dom/ssr/single-fetch.js +7 -7
  119. package/dist/production/lib/dom-export/dom-router-provider.js +1 -1
  120. package/dist/production/lib/dom-export/hydrated-router.d.ts +1 -1
  121. package/dist/production/lib/dom-export/hydrated-router.js +5 -3
  122. package/dist/production/lib/errors.js +1 -1
  123. package/dist/production/lib/hooks.d.ts +0 -3
  124. package/dist/production/lib/hooks.js +13 -9
  125. package/dist/production/lib/href.js +4 -4
  126. package/dist/production/lib/router/history.js +1 -1
  127. package/dist/production/lib/router/instrumentation.js +1 -1
  128. package/dist/production/lib/router/matcher-route-pattern.js +1 -1
  129. package/dist/production/lib/router/matcher-route-pattern.preload.js +1 -1
  130. package/dist/production/lib/router/matcher.js +6 -1
  131. package/dist/production/lib/router/navigation.js +17 -2
  132. package/dist/production/lib/router/router.d.ts +2 -0
  133. package/dist/production/lib/router/router.js +62 -29
  134. package/dist/production/lib/router/url.js +1 -1
  135. package/dist/production/lib/router/utils.d.ts +13 -5
  136. package/dist/production/lib/router/utils.js +17 -8
  137. package/dist/production/lib/rsc/browser.js +28 -5
  138. package/dist/production/lib/rsc/errorBoundaries.js +1 -1
  139. package/dist/production/lib/rsc/html-stream/browser.js +1 -1
  140. package/dist/production/lib/rsc/html-stream/server.js +1 -1
  141. package/dist/production/lib/rsc/route-modules.js +1 -1
  142. package/dist/production/lib/rsc/server.rsc.d.ts +2 -0
  143. package/dist/production/lib/rsc/server.ssr.js +1 -1
  144. package/dist/production/lib/server-runtime/cookies.js +1 -1
  145. package/dist/production/lib/server-runtime/crypto.js +1 -1
  146. package/dist/production/lib/server-runtime/data.js +1 -1
  147. package/dist/production/lib/server-runtime/dev.js +1 -1
  148. package/dist/production/lib/server-runtime/entry.js +1 -1
  149. package/dist/production/lib/server-runtime/errors.js +1 -1
  150. package/dist/production/lib/server-runtime/headers.js +1 -1
  151. package/dist/production/lib/server-runtime/invariant.js +1 -1
  152. package/dist/production/lib/server-runtime/mode.js +1 -1
  153. package/dist/production/lib/server-runtime/routeMatching.js +1 -1
  154. package/dist/production/lib/server-runtime/routes.js +1 -1
  155. package/dist/production/lib/server-runtime/server.js +21 -10
  156. package/dist/production/lib/server-runtime/serverHandoff.js +1 -1
  157. package/dist/production/lib/server-runtime/sessions/cookieStorage.js +1 -1
  158. package/dist/production/lib/server-runtime/sessions/memoryStorage.js +1 -1
  159. package/dist/production/lib/server-runtime/sessions.js +2 -2
  160. package/dist/production/lib/server-runtime/single-fetch.js +1 -1
  161. package/dist/production/lib/server-runtime/urls.js +1 -1
  162. package/dist/production/lib/server-runtime/warnings.js +1 -1
  163. package/dist/production/lib/types/internal.js +1 -1
  164. package/dist/production/lib/types/route-module-annotations.d.ts +1 -1
  165. package/dist/production/route-pattern.js +1 -1
  166. package/dist/production/vendor/turbo-stream-v2/flatten.js +1 -1
  167. package/dist/production/vendor/turbo-stream-v2/turbo-stream.js +75 -66
  168. package/dist/production/vendor/turbo-stream-v2/unflatten.js +23 -3
  169. package/dist/production/vendor/turbo-stream-v2/utils.js +1 -1
  170. package/docs/explanation/backend-for-frontend.md +0 -3
  171. package/docs/explanation/code-splitting.md +0 -3
  172. package/docs/explanation/concurrency.md +0 -3
  173. package/docs/explanation/hot-module-replacement.md +0 -3
  174. package/docs/explanation/lazy-route-discovery.md +0 -3
  175. package/docs/explanation/progressive-enhancement.md +0 -3
  176. package/docs/explanation/race-conditions.md +0 -3
  177. package/docs/explanation/react-transitions.md +0 -3
  178. package/docs/explanation/sessions-and-cookies.md +1 -1
  179. package/docs/explanation/state-management.md +0 -3
  180. package/docs/explanation/styling.md +0 -3
  181. package/docs/explanation/type-safety.md +0 -3
  182. package/docs/how-to/accessibility.md +0 -6
  183. package/docs/how-to/client-data.md +0 -3
  184. package/docs/how-to/data-strategy.md +0 -3
  185. package/docs/how-to/error-boundary.md +0 -3
  186. package/docs/how-to/error-reporting.md +0 -3
  187. package/docs/how-to/fetchers.md +0 -3
  188. package/docs/how-to/file-route-conventions.md +0 -3
  189. package/docs/how-to/file-uploads.md +0 -3
  190. package/docs/how-to/form-validation.md +0 -3
  191. package/docs/how-to/headers.md +0 -3
  192. package/docs/how-to/instrumentation.md +0 -3
  193. package/docs/how-to/middleware.md +6 -3
  194. package/docs/how-to/navigation-blocking.md +0 -3
  195. package/docs/how-to/optimize-revalidation.md +0 -3
  196. package/docs/how-to/pre-rendering.md +0 -3
  197. package/docs/how-to/presets.md +0 -3
  198. package/docs/how-to/react-server-components.md +0 -3
  199. package/docs/how-to/resource-routes.md +0 -3
  200. package/docs/how-to/route-discovery.md +4 -2
  201. package/docs/how-to/route-module-type-safety.md +0 -3
  202. package/docs/how-to/security.md +0 -3
  203. package/docs/how-to/server-bundles.md +0 -3
  204. package/docs/how-to/spa.md +0 -3
  205. package/docs/how-to/status.md +0 -3
  206. package/docs/how-to/suspense.md +22 -6
  207. package/docs/how-to/using-handle.md +0 -3
  208. package/docs/how-to/view-transitions.md +0 -3
  209. package/docs/start/framework/data-loading.md +9 -0
  210. package/docs/upgrading/future.md +0 -12
  211. package/docs/upgrading/v7.md +14 -33
  212. package/package.json +1 -1
  213. package/dist/development/lib/dom/global.d.ts +0 -35
  214. package/dist/production/lib/dom/global.d.ts +0 -35
package/CHANGELOG.md CHANGED
@@ -1,5 +1,74 @@
1
1
  # `react-router`
2
2
 
3
+ ## v8.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Keep navigation metadata consistent after a submission action throws an error ([#15621](https://github.com/remix-run/react-router/pull/15621))
8
+ - Use the committed history action for loader `dataStrategy` navigation types and loading navigation history actions
9
+ - Cancel the discarded response body for `HEAD` requests, so a resource route streaming a file no longer leaks its file descriptor ([#15634](https://github.com/remix-run/react-router/pull/15634))
10
+ - Keep observing nested deferred promise rejections after cancelling a data response so they cannot crash the server
11
+ - Preserve streamed `<Suspense>` boundaries during hydration in development ([#15382](https://github.com/remix-run/react-router/pull/15382))
12
+ - Wrap the critical CSS reset in `React.startTransition` to prevent React 19 from silently discarding the server HTML and rendering the boundary on the client
13
+ - Fix submissions to root form actions containing search parameters or a hash when a `basename` is configured ([#15725](https://github.com/remix-run/react-router/pull/15725))
14
+ - Fix `href()` to throw for `null` required parameters and omit `null` splat parameters without a trailing slash, matching the behavior for `undefined` and the defined types ([#15754](https://github.com/remix-run/react-router/pull/15754))
15
+ - Fix generated `MetaArgs.matches` types to stop at the current route instead of appending an unknown, possibly undefined tail ([#15697](https://github.com/remix-run/react-router/pull/15697))
16
+ - Improve path generation and URL validation across `href()`, `generatePath()`, links, forms, fetchers, and redirects ([#15785](https://github.com/remix-run/react-router/pull/15785))
17
+ - Stop `redirect()`, `redirectDocument()` and `replace()` from setting `status: 302` on the `ResponseInit` passed to them ([#15753](https://github.com/remix-run/react-router/pull/15753))
18
+ - Later responses created from the same init object no longer get status 302, and a frozen init no longer throws
19
+ - Clear an `<Await>` render error when it receives a new `resolve` value, so the error element no longer stays on screen after navigating to a route whose data renders fine ([#15695](https://github.com/remix-run/react-router/pull/15695))
20
+ - Run `clientMiddleware` during RSC client navigations and preserve it when route components update via HMR ([#15763](https://github.com/remix-run/react-router/pull/15763))
21
+ - Handle `HEAD` resource responses consistently in RSC Framework and RSC Data modes ([#15783](https://github.com/remix-run/react-router/pull/15783))
22
+ - Fix initial rendering of RSC routes with a `clientLoader` and no `HydrateFallback` ([#15763](https://github.com/remix-run/react-router/pull/15763))
23
+ - Fix `<ScrollRestoration>` throwing an uncaught error before hydration when `sessionStorage` is unavailable ([#15566](https://github.com/remix-run/react-router/pull/15566))
24
+ - The inline restore script already logged the storage error, but its cleanup call accessed `sessionStorage` again and threw (e.g. Chrome with "Block all cookies", sandboxed cross-origin iframes)
25
+ - The error is still logged with `console.error`; only the second, uncaught throw is removed
26
+ - Fix `useBlocker` leaving behind a stale blocker that keeps blocking navigation after its component is hidden and shown again with `<Activity>`, or after the router is recreated ([#15710](https://github.com/remix-run/react-router/pull/15710))
27
+
28
+ ## v8.5.1
29
+
30
+ ### Patch Changes
31
+
32
+ - Fix `URIError: URI malformed` when an `ssr: false` dev server receives a URL path with a malformed percent-encoding ([#15649](https://github.com/remix-run/react-router/pull/15649))
33
+ - Bound server route manifest processing for paths with expensive route expansion ([#15703](https://github.com/remix-run/react-router/pull/15703))
34
+ - Fall back to initial route discovery during server rendering and RSC document/data requests
35
+ - Account for the number and depth of candidate branches when using regex matching
36
+ - 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))
37
+ - 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))
38
+ - 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))
39
+ - Replace the current history entry when the `action` contains characters that get percent-encoded, such as spaces or non-ASCII characters
40
+ - 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))
41
+ - Bubble rejected `lazy.Component` imports on loader-less routes to the nearest error boundary ([#15658](https://github.com/remix-run/react-router/pull/15658))
42
+ - Render the error boundary instead of a blank page
43
+ - 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))
44
+ - Keep newer fetcher loads cancellable and preserve them when earlier revalidations finish or abort, preventing older responses from overwriting fresh fetcher data
45
+ - Retry rejected `lazy` route imports instead of caching failures permanently ([#15689](https://github.com/remix-run/react-router/pull/15689))
46
+ - Revalidate loader data when a fetcher action redirect is not followed ([#15557](https://github.com/remix-run/react-router/pull/15557))
47
+ - Revalidate when an action redirect is ignored because a newer navigation started or the fetcher unmounted while the action was running
48
+ - Include shared parent loaders when another navigation completed while the action was running
49
+ - Continue to respect `shouldRevalidate`
50
+ - Return fetchers to `idle` when a revalidation completes a pending navigation started by another fetcher's redirect
51
+ - Avoid adding an incompatible `document.startViewTransition()` overload to the global `Document` type ([#15680](https://github.com/remix-run/react-router/pull/15680))
52
+ - Allow transition results to be assigned to the DOM `ViewTransition` type
53
+ - Skip `deleteData` in `destroySession` when the session has no ID ([#15639](https://github.com/remix-run/react-router/pull/15639))
54
+ - Avoid failures when destroying a session without a cookie on storage that rejects an empty key
55
+ - 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))
56
+ - Request single-fetch `.data` files for hydrating routes with a server `loader` in an `ssr: false` app with a `prerender` config
57
+ - Avoid the internal "No result found for routeId" error for non-prerendered parameterized paths served via the SPA fallback
58
+ - Improve turbo-stream decoding validation and object property handling ([18e1fbd](https://github.com/remix-run/react-router/commit/18e1fbd))
59
+
60
+ ### Unstable Changes
61
+
62
+ ⚠️ _[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use_
63
+
64
+ - 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))
65
+ - Use `React.use` instead of React Router's internal promise tracking
66
+ - Accept promise-like values and retain `errorElement`, `useAsyncValue`, and `useAsyncError` support
67
+ - Handle only promise rejections with `errorElement` when using `unstable_promise`, allowing child render errors to bubble to the nearest React error boundary
68
+ - Track streamed promises during decoding so settled server content stays visible during hydration updates with either Await API or direct `React.use()`
69
+ - Fix `URIError: URI malformed` when an API-only (`ssr: "unstable_api-only"`) server receives a URL path with a malformed percent-encoding ([#15649](https://github.com/remix-run/react-router/pull/15649))
70
+ - Fix duplicate headers when throwing a redirect from an RSC server function ([#15667](https://github.com/remix-run/react-router/pull/15667))
71
+
3
72
  ## v8.5.0
4
73
 
5
74
  ### Minor Changes
@@ -23,7 +92,7 @@
23
92
 
24
93
  ### Unstable Changes
25
94
 
26
- ⚠️ _[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use_
95
+ ⚠️ _[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use_
27
96
 
28
97
  - 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))
29
98
  - The function receives the intended request as well as context identifying the type of request
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v8.5.0
2
+ * react-router v8.5.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v8.5.0
2
+ * react-router v8.5.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *