| [9af201e] | 1 | # `react-router`
|
|---|
| 2 |
|
|---|
| 3 | ## 6.30.3
|
|---|
| 4 |
|
|---|
| 5 | ### Patch Changes
|
|---|
| 6 |
|
|---|
| 7 | - Updated dependencies:
|
|---|
| 8 | - `@remix-run/router@1.23.2`
|
|---|
| 9 |
|
|---|
| 10 | ## 6.30.2
|
|---|
| 11 |
|
|---|
| 12 | ### Patch Changes
|
|---|
| 13 |
|
|---|
| 14 | - Updated dependencies:
|
|---|
| 15 | - `@remix-run/router@1.23.1`
|
|---|
| 16 |
|
|---|
| 17 | ## 6.30.1
|
|---|
| 18 |
|
|---|
| 19 | ### Patch Changes
|
|---|
| 20 |
|
|---|
| 21 | - Partially revert optimization added in `6.29.0` to reduce calls to `matchRoutes` because it surfaced other issues ([#13623](https://github.com/remix-run/react-router/pull/13623))
|
|---|
| 22 | - Stop logging invalid warning when `v7_relativeSplatPath` is set to false ([#13502](https://github.com/remix-run/react-router/pull/13502))
|
|---|
| 23 |
|
|---|
| 24 | ## 6.30.0
|
|---|
| 25 |
|
|---|
| 26 | ### Minor Changes
|
|---|
| 27 |
|
|---|
| 28 | - Add `fetcherKey` as a parameter to `patchRoutesOnNavigation` ([#13109](https://github.com/remix-run/react-router/pull/13109))
|
|---|
| 29 |
|
|---|
| 30 | ### Patch Changes
|
|---|
| 31 |
|
|---|
| 32 | - Updated dependencies:
|
|---|
| 33 | - `@remix-run/router@1.23.0`
|
|---|
| 34 |
|
|---|
| 35 | ## 6.29.0
|
|---|
| 36 |
|
|---|
| 37 | ### Minor Changes
|
|---|
| 38 |
|
|---|
| 39 | - Provide the request `signal` as a parameter to `patchRoutesOnNavigation` ([#12900](https://github.com/remix-run/react-router/pull/12900))
|
|---|
| 40 |
|
|---|
| 41 | - This can be used to abort any manifest fetches if the in-flight navigation/fetcher is aborted
|
|---|
| 42 |
|
|---|
| 43 | ### Patch Changes
|
|---|
| 44 |
|
|---|
| 45 | - Do not log v7 deprecation warnings in production builds ([#12794](https://github.com/remix-run/react-router/pull/12794))
|
|---|
| 46 | - Limit matchRoutes optimization to client side routers ([#12881](https://github.com/remix-run/react-router/pull/12881))
|
|---|
| 47 | - Optimize route matching by skipping redundant `matchRoutes` calls when possible ([#12169](https://github.com/remix-run/react-router/pull/12169))
|
|---|
| 48 | - Updated dependencies:
|
|---|
| 49 | - `@remix-run/router@1.22.0`
|
|---|
| 50 |
|
|---|
| 51 | ## 6.28.2
|
|---|
| 52 |
|
|---|
| 53 | ### Patch Changes
|
|---|
| 54 |
|
|---|
| 55 | - Updated dependencies:
|
|---|
| 56 | - `@remix-run/router@1.21.1`
|
|---|
| 57 |
|
|---|
| 58 | ## 6.28.1
|
|---|
| 59 |
|
|---|
| 60 | ### Patch Changes
|
|---|
| 61 |
|
|---|
| 62 | - Allow users to opt out of deprecation warnings by setting flags to false ([#12441](https://github.com/remix-run/react-router/pull/12441))
|
|---|
| 63 |
|
|---|
| 64 | ## 6.28.0
|
|---|
| 65 |
|
|---|
| 66 | ### Minor Changes
|
|---|
| 67 |
|
|---|
| 68 | - Log deprecation warnings for v7 flags ([#11750](https://github.com/remix-run/react-router/pull/11750))
|
|---|
| 69 | - Add deprecation warnings to `json`/`defer` in favor of returning raw objects
|
|---|
| 70 | - These methods will be removed in React Router v7
|
|---|
| 71 |
|
|---|
| 72 | ### Patch Changes
|
|---|
| 73 |
|
|---|
| 74 | - Update JSDoc URLs for new website structure (add /v6/ segment) ([#12141](https://github.com/remix-run/react-router/pull/12141))
|
|---|
| 75 | - Updated dependencies:
|
|---|
| 76 | - `@remix-run/router@1.21.0`
|
|---|
| 77 |
|
|---|
| 78 | ## 6.27.0
|
|---|
| 79 |
|
|---|
| 80 | ### Minor Changes
|
|---|
| 81 |
|
|---|
| 82 | - Stabilize `unstable_patchRoutesOnNavigation` ([#11973](https://github.com/remix-run/react-router/pull/11973))
|
|---|
| 83 | - Add new `PatchRoutesOnNavigationFunctionArgs` type for convenience ([#11967](https://github.com/remix-run/react-router/pull/11967))
|
|---|
| 84 | - Stabilize `unstable_dataStrategy` ([#11974](https://github.com/remix-run/react-router/pull/11974))
|
|---|
| 85 | - Stabilize the `unstable_flushSync` option for navigations and fetchers ([#11989](https://github.com/remix-run/react-router/pull/11989))
|
|---|
| 86 | - Stabilize the `unstable_viewTransition` option for navigations and the corresponding `unstable_useViewTransitionState` hook ([#11989](https://github.com/remix-run/react-router/pull/11989))
|
|---|
| 87 |
|
|---|
| 88 | ### Patch Changes
|
|---|
| 89 |
|
|---|
| 90 | - Fix bug when submitting to the current contextual route (parent route with an index child) when an `?index` param already exists from a prior submission ([#12003](https://github.com/remix-run/react-router/pull/12003))
|
|---|
| 91 |
|
|---|
| 92 | - Fix `useFormAction` bug - when removing `?index` param it would not keep other non-Remix `index` params ([#12003](https://github.com/remix-run/react-router/pull/12003))
|
|---|
| 93 |
|
|---|
| 94 | - Fix types for `RouteObject` within `PatchRoutesOnNavigationFunction`'s `patch` method so it doesn't expect agnostic route objects passed to `patch` ([#11967](https://github.com/remix-run/react-router/pull/11967))
|
|---|
| 95 |
|
|---|
| 96 | - Updated dependencies:
|
|---|
| 97 | - `@remix-run/router@1.20.0`
|
|---|
| 98 |
|
|---|
| 99 | ## 6.26.2
|
|---|
| 100 |
|
|---|
| 101 | ### Patch Changes
|
|---|
| 102 |
|
|---|
| 103 | - Updated dependencies:
|
|---|
| 104 | - `@remix-run/router@1.19.2`
|
|---|
| 105 |
|
|---|
| 106 | ## 6.26.1
|
|---|
| 107 |
|
|---|
| 108 | ### Patch Changes
|
|---|
| 109 |
|
|---|
| 110 | - Rename `unstable_patchRoutesOnMiss` to `unstable_patchRoutesOnNavigation` to match new behavior ([#11888](https://github.com/remix-run/react-router/pull/11888))
|
|---|
| 111 | - Updated dependencies:
|
|---|
| 112 | - `@remix-run/router@1.19.1`
|
|---|
| 113 |
|
|---|
| 114 | ## 6.26.0
|
|---|
| 115 |
|
|---|
| 116 | ### Minor Changes
|
|---|
| 117 |
|
|---|
| 118 | - Add a new `replace(url, init?)` alternative to `redirect(url, init?)` that performs a `history.replaceState` instead of a `history.pushState` on client-side navigation redirects ([#11811](https://github.com/remix-run/react-router/pull/11811))
|
|---|
| 119 |
|
|---|
| 120 | ### Patch Changes
|
|---|
| 121 |
|
|---|
| 122 | - Fix initial hydration behavior when using `future.v7_partialHydration` along with `unstable_patchRoutesOnMiss` ([#11838](https://github.com/remix-run/react-router/pull/11838))
|
|---|
| 123 | - During initial hydration, `router.state.matches` will now include any partial matches so that we can render ancestor `HydrateFallback` components
|
|---|
| 124 | - Updated dependencies:
|
|---|
| 125 | - `@remix-run/router@1.19.0`
|
|---|
| 126 |
|
|---|
| 127 | ## 6.25.1
|
|---|
| 128 |
|
|---|
| 129 | No significant changes to this package were made in this release. [See the repo `CHANGELOG.md`](https://github.com/remix-run/react-router/blob/main/CHANGELOG.md) for an overview of all changes in v6.25.1.
|
|---|
| 130 |
|
|---|
| 131 | ## 6.25.0
|
|---|
| 132 |
|
|---|
| 133 | ### Minor Changes
|
|---|
| 134 |
|
|---|
| 135 | - Stabilize `future.unstable_skipActionErrorRevalidation` as `future.v7_skipActionErrorRevalidation` ([#11769](https://github.com/remix-run/react-router/pull/11769))
|
|---|
| 136 | - When this flag is enabled, actions will not automatically trigger a revalidation if they return/throw a `Response` with a `4xx`/`5xx` status code
|
|---|
| 137 | - You may still opt-into revalidation via `shouldRevalidate`
|
|---|
| 138 | - This also changes `shouldRevalidate`'s `unstable_actionStatus` parameter to `actionStatus`
|
|---|
| 139 |
|
|---|
| 140 | ### Patch Changes
|
|---|
| 141 |
|
|---|
| 142 | - Fix regression and properly decode paths inside `useMatch` so matches/params reflect decoded params ([#11789](https://github.com/remix-run/react-router/pull/11789))
|
|---|
| 143 | - Updated dependencies:
|
|---|
| 144 | - `@remix-run/router@1.18.0`
|
|---|
| 145 |
|
|---|
| 146 | ## 6.24.1
|
|---|
| 147 |
|
|---|
| 148 | ### Patch Changes
|
|---|
| 149 |
|
|---|
| 150 | - When using `future.v7_relativeSplatPath`, properly resolve relative paths in splat routes that are children of pathless routes ([#11633](https://github.com/remix-run/react-router/pull/11633))
|
|---|
| 151 | - Updated dependencies:
|
|---|
| 152 | - `@remix-run/router@1.17.1`
|
|---|
| 153 |
|
|---|
| 154 | ## 6.24.0
|
|---|
| 155 |
|
|---|
| 156 | ### Minor Changes
|
|---|
| 157 |
|
|---|
| 158 | - Add support for Lazy Route Discovery (a.k.a. Fog of War) ([#11626](https://github.com/remix-run/react-router/pull/11626))
|
|---|
| 159 | - RFC: <https://github.com/remix-run/react-router/discussions/11113>
|
|---|
| 160 | - `unstable_patchRoutesOnMiss` docs: <https://reactrouter.com/v6/routers/create-browser-router>
|
|---|
| 161 |
|
|---|
| 162 | ### Patch Changes
|
|---|
| 163 |
|
|---|
| 164 | - Updated dependencies:
|
|---|
| 165 | - `@remix-run/router@1.17.0`
|
|---|
| 166 |
|
|---|
| 167 | ## 6.23.1
|
|---|
| 168 |
|
|---|
| 169 | ### Patch Changes
|
|---|
| 170 |
|
|---|
| 171 | - allow undefined to be resolved with `<Await>` ([#11513](https://github.com/remix-run/react-router/pull/11513))
|
|---|
| 172 | - Updated dependencies:
|
|---|
| 173 | - `@remix-run/router@1.16.1`
|
|---|
| 174 |
|
|---|
| 175 | ## 6.23.0
|
|---|
| 176 |
|
|---|
| 177 | ### Minor Changes
|
|---|
| 178 |
|
|---|
| 179 | - Add a new `unstable_dataStrategy` configuration option ([#11098](https://github.com/remix-run/react-router/pull/11098))
|
|---|
| 180 | - This option allows Data Router applications to take control over the approach for executing route loaders and actions
|
|---|
| 181 | - The default implementation is today's behavior, to fetch all loaders in parallel, but this option allows users to implement more advanced data flows including Remix single-fetch, middleware/context APIs, automatic loader caching, and more
|
|---|
| 182 |
|
|---|
| 183 | ### Patch Changes
|
|---|
| 184 |
|
|---|
| 185 | - Updated dependencies:
|
|---|
| 186 | - `@remix-run/router@1.16.0`
|
|---|
| 187 |
|
|---|
| 188 | ## 6.22.3
|
|---|
| 189 |
|
|---|
| 190 | ### Patch Changes
|
|---|
| 191 |
|
|---|
| 192 | - Updated dependencies:
|
|---|
| 193 | - `@remix-run/router@1.15.3`
|
|---|
| 194 |
|
|---|
| 195 | ## 6.22.2
|
|---|
| 196 |
|
|---|
| 197 | ### Patch Changes
|
|---|
| 198 |
|
|---|
| 199 | - Updated dependencies:
|
|---|
| 200 | - `@remix-run/router@1.15.2`
|
|---|
| 201 |
|
|---|
| 202 | ## 6.22.1
|
|---|
| 203 |
|
|---|
| 204 | ### Patch Changes
|
|---|
| 205 |
|
|---|
| 206 | - Fix encoding/decoding issues with pre-encoded dynamic parameter values ([#11199](https://github.com/remix-run/react-router/pull/11199))
|
|---|
| 207 | - Updated dependencies:
|
|---|
| 208 | - `@remix-run/router@1.15.1`
|
|---|
| 209 |
|
|---|
| 210 | ## 6.22.0
|
|---|
| 211 |
|
|---|
| 212 | ### Patch Changes
|
|---|
| 213 |
|
|---|
| 214 | - Updated dependencies:
|
|---|
| 215 | - `@remix-run/router@1.15.0`
|
|---|
| 216 |
|
|---|
| 217 | ## 6.21.3
|
|---|
| 218 |
|
|---|
| 219 | ### Patch Changes
|
|---|
| 220 |
|
|---|
| 221 | - Remove leftover `unstable_` prefix from `Blocker`/`BlockerFunction` types ([#11187](https://github.com/remix-run/react-router/pull/11187))
|
|---|
| 222 |
|
|---|
| 223 | ## 6.21.2
|
|---|
| 224 |
|
|---|
| 225 | ### Patch Changes
|
|---|
| 226 |
|
|---|
| 227 | - Updated dependencies:
|
|---|
| 228 | - `@remix-run/router@1.14.2`
|
|---|
| 229 |
|
|---|
| 230 | ## 6.21.1
|
|---|
| 231 |
|
|---|
| 232 | ### Patch Changes
|
|---|
| 233 |
|
|---|
| 234 | - Fix bug with `route.lazy` not working correctly on initial SPA load when `v7_partialHydration` is specified ([#11121](https://github.com/remix-run/react-router/pull/11121))
|
|---|
| 235 | - Updated dependencies:
|
|---|
| 236 | - `@remix-run/router@1.14.1`
|
|---|
| 237 |
|
|---|
| 238 | ## 6.21.0
|
|---|
| 239 |
|
|---|
| 240 | ### Minor Changes
|
|---|
| 241 |
|
|---|
| 242 | - Add a new `future.v7_relativeSplatPath` flag to implement a breaking bug fix to relative routing when inside a splat route. ([#11087](https://github.com/remix-run/react-router/pull/11087))
|
|---|
| 243 |
|
|---|
| 244 | This fix was originally added in [#10983](https://github.com/remix-run/react-router/issues/10983) and was later reverted in [#11078](https://github.com/remix-run/react-router/pull/11078) because it was determined that a large number of existing applications were relying on the buggy behavior (see [#11052](https://github.com/remix-run/react-router/issues/11052))
|
|---|
| 245 |
|
|---|
| 246 | **The Bug**
|
|---|
| 247 | The buggy behavior is that without this flag, the default behavior when resolving relative paths is to _ignore_ any splat (`*`) portion of the current route path.
|
|---|
| 248 |
|
|---|
| 249 | **The Background**
|
|---|
| 250 | This decision was originally made thinking that it would make the concept of nested different sections of your apps in `<Routes>` easier if relative routing would _replace_ the current splat:
|
|---|
| 251 |
|
|---|
| 252 | ```jsx
|
|---|
| 253 | <BrowserRouter>
|
|---|
| 254 | <Routes>
|
|---|
| 255 | <Route path="/" element={<Home />} />
|
|---|
| 256 | <Route path="dashboard/*" element={<Dashboard />} />
|
|---|
| 257 | </Routes>
|
|---|
| 258 | </BrowserRouter>
|
|---|
| 259 | ```
|
|---|
| 260 |
|
|---|
| 261 | Any paths like `/dashboard`, `/dashboard/team`, `/dashboard/projects` will match the `Dashboard` route. The dashboard component itself can then render nested `<Routes>`:
|
|---|
| 262 |
|
|---|
| 263 | ```jsx
|
|---|
| 264 | function Dashboard() {
|
|---|
| 265 | return (
|
|---|
| 266 | <div>
|
|---|
| 267 | <h2>Dashboard</h2>
|
|---|
| 268 | <nav>
|
|---|
| 269 | <Link to="/">Dashboard Home</Link>
|
|---|
| 270 | <Link to="team">Team</Link>
|
|---|
| 271 | <Link to="projects">Projects</Link>
|
|---|
| 272 | </nav>
|
|---|
| 273 |
|
|---|
| 274 | <Routes>
|
|---|
| 275 | <Route path="/" element={<DashboardHome />} />
|
|---|
| 276 | <Route path="team" element={<DashboardTeam />} />
|
|---|
| 277 | <Route path="projects" element={<DashboardProjects />} />
|
|---|
| 278 | </Routes>
|
|---|
| 279 | </div>
|
|---|
| 280 | );
|
|---|
| 281 | }
|
|---|
| 282 | ```
|
|---|
| 283 |
|
|---|
| 284 | Now, all links and route paths are relative to the router above them. This makes code splitting and compartmentalizing your app really easy. You could render the `Dashboard` as its own independent app, or embed it into your large app without making any changes to it.
|
|---|
| 285 |
|
|---|
| 286 | **The Problem**
|
|---|
| 287 |
|
|---|
| 288 | The problem is that this concept of ignoring part of a path breaks a lot of other assumptions in React Router - namely that `"."` always means the current location pathname for that route. When we ignore the splat portion, we start getting invalid paths when using `"."`:
|
|---|
| 289 |
|
|---|
| 290 | ```jsx
|
|---|
| 291 | // If we are on URL /dashboard/team, and we want to link to /dashboard/team:
|
|---|
| 292 | function DashboardTeam() {
|
|---|
| 293 | // ❌ This is broken and results in <a href="/dashboard">
|
|---|
| 294 | return <Link to=".">A broken link to the Current URL</Link>;
|
|---|
| 295 |
|
|---|
| 296 | // ✅ This is fixed but super unintuitive since we're already at /dashboard/team!
|
|---|
| 297 | return <Link to="./team">A broken link to the Current URL</Link>;
|
|---|
| 298 | }
|
|---|
| 299 | ```
|
|---|
| 300 |
|
|---|
| 301 | We've also introduced an issue that we can no longer move our `DashboardTeam` component around our route hierarchy easily - since it behaves differently if we're underneath a non-splat route, such as `/dashboard/:widget`. Now, our `"."` links will, properly point to ourself _inclusive of the dynamic param value_ so behavior will break from it's corresponding usage in a `/dashboard/*` route.
|
|---|
| 302 |
|
|---|
| 303 | Even worse, consider a nested splat route configuration:
|
|---|
| 304 |
|
|---|
| 305 | ```jsx
|
|---|
| 306 | <BrowserRouter>
|
|---|
| 307 | <Routes>
|
|---|
| 308 | <Route path="dashboard">
|
|---|
| 309 | <Route path="*" element={<Dashboard />} />
|
|---|
| 310 | </Route>
|
|---|
| 311 | </Routes>
|
|---|
| 312 | </BrowserRouter>
|
|---|
| 313 | ```
|
|---|
| 314 |
|
|---|
| 315 | Now, a `<Link to=".">` and a `<Link to="..">` inside the `Dashboard` component go to the same place! That is definitely not correct!
|
|---|
| 316 |
|
|---|
| 317 | Another common issue arose in Data Routers (and Remix) where any `<Form>` should post to it's own route `action` if you the user doesn't specify a form action:
|
|---|
| 318 |
|
|---|
| 319 | ```jsx
|
|---|
| 320 | let router = createBrowserRouter({
|
|---|
| 321 | path: "/dashboard",
|
|---|
| 322 | children: [
|
|---|
| 323 | {
|
|---|
| 324 | path: "*",
|
|---|
| 325 | action: dashboardAction,
|
|---|
| 326 | Component() {
|
|---|
| 327 | // ❌ This form is broken! It throws a 405 error when it submits because
|
|---|
| 328 | // it tries to submit to /dashboard (without the splat value) and the parent
|
|---|
| 329 | // `/dashboard` route doesn't have an action
|
|---|
| 330 | return <Form method="post">...</Form>;
|
|---|
| 331 | },
|
|---|
| 332 | },
|
|---|
| 333 | ],
|
|---|
| 334 | });
|
|---|
| 335 | ```
|
|---|
| 336 |
|
|---|
| 337 | This is just a compounded issue from the above because the default location for a `Form` to submit to is itself (`"."`) - and if we ignore the splat portion, that now resolves to the parent route.
|
|---|
| 338 |
|
|---|
| 339 | **The Solution**
|
|---|
| 340 | If you are leveraging this behavior, it's recommended to enable the future flag, move your splat to it's own route, and leverage `../` for any links to "sibling" pages:
|
|---|
| 341 |
|
|---|
| 342 | ```jsx
|
|---|
| 343 | <BrowserRouter>
|
|---|
| 344 | <Routes>
|
|---|
| 345 | <Route path="dashboard">
|
|---|
| 346 | <Route index path="*" element={<Dashboard />} />
|
|---|
| 347 | </Route>
|
|---|
| 348 | </Routes>
|
|---|
| 349 | </BrowserRouter>
|
|---|
| 350 |
|
|---|
| 351 | function Dashboard() {
|
|---|
| 352 | return (
|
|---|
| 353 | <div>
|
|---|
| 354 | <h2>Dashboard</h2>
|
|---|
| 355 | <nav>
|
|---|
| 356 | <Link to="..">Dashboard Home</Link>
|
|---|
| 357 | <Link to="../team">Team</Link>
|
|---|
| 358 | <Link to="../projects">Projects</Link>
|
|---|
| 359 | </nav>
|
|---|
| 360 |
|
|---|
| 361 | <Routes>
|
|---|
| 362 | <Route path="/" element={<DashboardHome />} />
|
|---|
| 363 | <Route path="team" element={<DashboardTeam />} />
|
|---|
| 364 | <Route path="projects" element={<DashboardProjects />} />
|
|---|
| 365 | </Router>
|
|---|
| 366 | </div>
|
|---|
| 367 | );
|
|---|
| 368 | }
|
|---|
| 369 | ```
|
|---|
| 370 |
|
|---|
| 371 | This way, `.` means "the full current pathname for my route" in all cases (including static, dynamic, and splat routes) and `..` always means "my parents pathname".
|
|---|
| 372 |
|
|---|
| 373 | ### Patch Changes
|
|---|
| 374 |
|
|---|
| 375 | - Properly handle falsy error values in ErrorBoundary's ([#11071](https://github.com/remix-run/react-router/pull/11071))
|
|---|
| 376 | - Updated dependencies:
|
|---|
| 377 | - `@remix-run/router@1.14.0`
|
|---|
| 378 |
|
|---|
| 379 | ## 6.20.1
|
|---|
| 380 |
|
|---|
| 381 | ### Patch Changes
|
|---|
| 382 |
|
|---|
| 383 | - Revert the `useResolvedPath` fix for splat routes due to a large number of applications that were relying on the buggy behavior (see <https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329>). We plan to re-introduce this fix behind a future flag in the next minor version. ([#11078](https://github.com/remix-run/react-router/pull/11078))
|
|---|
| 384 | - Updated dependencies:
|
|---|
| 385 | - `@remix-run/router@1.13.1`
|
|---|
| 386 |
|
|---|
| 387 | ## 6.20.0
|
|---|
| 388 |
|
|---|
| 389 | ### Minor Changes
|
|---|
| 390 |
|
|---|
| 391 | - Export the `PathParam` type from the public API ([#10719](https://github.com/remix-run/react-router/pull/10719))
|
|---|
| 392 |
|
|---|
| 393 | ### Patch Changes
|
|---|
| 394 |
|
|---|
| 395 | - Fix bug with `resolveTo` in splat routes ([#11045](https://github.com/remix-run/react-router/pull/11045))
|
|---|
| 396 | - This is a follow up to [#10983](https://github.com/remix-run/react-router/pull/10983) to handle the few other code paths using `getPathContributingMatches`
|
|---|
| 397 | - This removes the `UNSAFE_getPathContributingMatches` export from `@remix-run/router` since we no longer need this in the `react-router`/`react-router-dom` layers
|
|---|
| 398 | - Updated dependencies:
|
|---|
| 399 | - `@remix-run/router@1.13.0`
|
|---|
| 400 |
|
|---|
| 401 | ## 6.19.0
|
|---|
| 402 |
|
|---|
| 403 | ### Minor Changes
|
|---|
| 404 |
|
|---|
| 405 | - Add `unstable_flushSync` option to `useNavigate`/`useSumbit`/`fetcher.load`/`fetcher.submit` to opt-out of `React.startTransition` and into `ReactDOM.flushSync` for state updates ([#11005](https://github.com/remix-run/react-router/pull/11005))
|
|---|
| 406 | - Remove the `unstable_` prefix from the [`useBlocker`](https://reactrouter.com/v6/hooks/use-blocker) hook as it's been in use for enough time that we are confident in the API. We do not plan to remove the prefix from `unstable_usePrompt` due to differences in how browsers handle `window.confirm` that prevent React Router from guaranteeing consistent/correct behavior. ([#10991](https://github.com/remix-run/react-router/pull/10991))
|
|---|
| 407 |
|
|---|
| 408 | ### Patch Changes
|
|---|
| 409 |
|
|---|
| 410 | - Fix `useActionData` so it returns proper contextual action data and not _any_ action data in the tree ([#11023](https://github.com/remix-run/react-router/pull/11023))
|
|---|
| 411 |
|
|---|
| 412 | - Fix bug in `useResolvedPath` that would cause `useResolvedPath(".")` in a splat route to lose the splat portion of the URL path. ([#10983](https://github.com/remix-run/react-router/pull/10983))
|
|---|
| 413 |
|
|---|
| 414 | - ⚠️ This fixes a quite long-standing bug specifically for `"."` paths inside a splat route which incorrectly dropped the splat portion of the URL. If you are relative routing via `"."` inside a splat route in your application you should double check that your logic is not relying on this buggy behavior and update accordingly.
|
|---|
| 415 |
|
|---|
| 416 | - Updated dependencies:
|
|---|
| 417 | - `@remix-run/router@1.12.0`
|
|---|
| 418 |
|
|---|
| 419 | ## 6.18.0
|
|---|
| 420 |
|
|---|
| 421 | ### Patch Changes
|
|---|
| 422 |
|
|---|
| 423 | - Fix the `future` prop on `BrowserRouter`, `HashRouter` and `MemoryRouter` so that it accepts a `Partial<FutureConfig>` instead of requiring all flags to be included. ([#10962](https://github.com/remix-run/react-router/pull/10962))
|
|---|
| 424 | - Updated dependencies:
|
|---|
| 425 | - `@remix-run/router@1.11.0`
|
|---|
| 426 |
|
|---|
| 427 | ## 6.17.0
|
|---|
| 428 |
|
|---|
| 429 | ### Patch Changes
|
|---|
| 430 |
|
|---|
| 431 | - Fix `RouterProvider` `future` prop type to be a `Partial<FutureConfig>` so that not all flags must be specified ([#10900](https://github.com/remix-run/react-router/pull/10900))
|
|---|
| 432 | - Updated dependencies:
|
|---|
| 433 | - `@remix-run/router@1.10.0`
|
|---|
| 434 |
|
|---|
| 435 | ## 6.16.0
|
|---|
| 436 |
|
|---|
| 437 | ### Minor Changes
|
|---|
| 438 |
|
|---|
| 439 | - In order to move towards stricter TypeScript support in the future, we're aiming to replace current usages of `any` with `unknown` on exposed typings for user-provided data. To do this in Remix v2 without introducing breaking changes in React Router v6, we have added generics to a number of shared types. These continue to default to `any` in React Router and are overridden with `unknown` in Remix. In React Router v7 we plan to move these to `unknown` as a breaking change. ([#10843](https://github.com/remix-run/react-router/pull/10843))
|
|---|
| 440 | - `Location` now accepts a generic for the `location.state` value
|
|---|
| 441 | - `ActionFunctionArgs`/`ActionFunction`/`LoaderFunctionArgs`/`LoaderFunction` now accept a generic for the `context` parameter (only used in SSR usages via `createStaticHandler`)
|
|---|
| 442 | - The return type of `useMatches` (now exported as `UIMatch`) accepts generics for `match.data` and `match.handle` - both of which were already set to `unknown`
|
|---|
| 443 | - Move the `@private` class export `ErrorResponse` to an `UNSAFE_ErrorResponseImpl` export since it is an implementation detail and there should be no construction of `ErrorResponse` instances in userland. This frees us up to export a `type ErrorResponse` which correlates to an instance of the class via `InstanceType`. Userland code should only ever be using `ErrorResponse` as a type and should be type-narrowing via `isRouteErrorResponse`. ([#10811](https://github.com/remix-run/react-router/pull/10811))
|
|---|
| 444 | - Export `ShouldRevalidateFunctionArgs` interface ([#10797](https://github.com/remix-run/react-router/pull/10797))
|
|---|
| 445 | - Removed private/internal APIs only required for the Remix v1 backwards compatibility layer and no longer needed in Remix v2 (`_isFetchActionRedirect`, `_hasFetcherDoneAnything`) ([#10715](https://github.com/remix-run/react-router/pull/10715))
|
|---|
| 446 |
|
|---|
| 447 | ### Patch Changes
|
|---|
| 448 |
|
|---|
| 449 | - Updated dependencies:
|
|---|
| 450 | - `@remix-run/router@1.9.0`
|
|---|
| 451 |
|
|---|
| 452 | ## 6.15.0
|
|---|
| 453 |
|
|---|
| 454 | ### Minor Changes
|
|---|
| 455 |
|
|---|
| 456 | - Add's a new `redirectDocument()` function which allows users to specify that a redirect from a `loader`/`action` should trigger a document reload (via `window.location`) instead of attempting to navigate to the redirected location via React Router ([#10705](https://github.com/remix-run/react-router/pull/10705))
|
|---|
| 457 |
|
|---|
| 458 | ### Patch Changes
|
|---|
| 459 |
|
|---|
| 460 | - Ensure `useRevalidator` is referentially stable across re-renders if revalidations are not actively occurring ([#10707](https://github.com/remix-run/react-router/pull/10707))
|
|---|
| 461 | - Updated dependencies:
|
|---|
| 462 | - `@remix-run/router@1.8.0`
|
|---|
| 463 |
|
|---|
| 464 | ## 6.14.2
|
|---|
| 465 |
|
|---|
| 466 | ### Patch Changes
|
|---|
| 467 |
|
|---|
| 468 | - Updated dependencies:
|
|---|
| 469 | - `@remix-run/router@1.7.2`
|
|---|
| 470 |
|
|---|
| 471 | ## 6.14.1
|
|---|
| 472 |
|
|---|
| 473 | ### Patch Changes
|
|---|
| 474 |
|
|---|
| 475 | - Fix loop in `unstable_useBlocker` when used with an unstable blocker function ([#10652](https://github.com/remix-run/react-router/pull/10652))
|
|---|
| 476 | - Fix issues with reused blockers on subsequent navigations ([#10656](https://github.com/remix-run/react-router/pull/10656))
|
|---|
| 477 | - Updated dependencies:
|
|---|
| 478 | - `@remix-run/router@1.7.1`
|
|---|
| 479 |
|
|---|
| 480 | ## 6.14.0
|
|---|
| 481 |
|
|---|
| 482 | ### Patch Changes
|
|---|
| 483 |
|
|---|
| 484 | - Strip `basename` from locations provided to `unstable_useBlocker` functions to match `useLocation` ([#10573](https://github.com/remix-run/react-router/pull/10573))
|
|---|
| 485 | - Fix `generatePath` when passed a numeric `0` value parameter ([#10612](https://github.com/remix-run/react-router/pull/10612))
|
|---|
| 486 | - Fix `unstable_useBlocker` key issues in `StrictMode` ([#10573](https://github.com/remix-run/react-router/pull/10573))
|
|---|
| 487 | - Fix `tsc --skipLibCheck:false` issues on React 17 ([#10622](https://github.com/remix-run/react-router/pull/10622))
|
|---|
| 488 | - Upgrade `typescript` to 5.1 ([#10581](https://github.com/remix-run/react-router/pull/10581))
|
|---|
| 489 | - Updated dependencies:
|
|---|
| 490 | - `@remix-run/router@1.7.0`
|
|---|
| 491 |
|
|---|
| 492 | ## 6.13.0
|
|---|
| 493 |
|
|---|
| 494 | ### Minor Changes
|
|---|
| 495 |
|
|---|
| 496 | - Move [`React.startTransition`](https://react.dev/reference/react/startTransition) usage behind a [future flag](https://reactrouter.com/v6/guides/api-development-strategy) to avoid issues with existing incompatible `Suspense` usages. We recommend folks adopting this flag to be better compatible with React concurrent mode, but if you run into issues you can continue without the use of `startTransition` until v7. Issues usually boils down to creating net-new promises during the render cycle, so if you run into issues you should either lift your promise creation out of the render cycle or put it behind a `useMemo`. ([#10596](https://github.com/remix-run/react-router/pull/10596))
|
|---|
| 497 |
|
|---|
| 498 | Existing behavior will no longer include `React.startTransition`:
|
|---|
| 499 |
|
|---|
| 500 | ```jsx
|
|---|
| 501 | <BrowserRouter>
|
|---|
| 502 | <Routes>{/*...*/}</Routes>
|
|---|
| 503 | </BrowserRouter>
|
|---|
| 504 |
|
|---|
| 505 | <RouterProvider router={router} />
|
|---|
| 506 | ```
|
|---|
| 507 |
|
|---|
| 508 | If you wish to enable `React.startTransition`, pass the future flag to your component:
|
|---|
| 509 |
|
|---|
| 510 | ```jsx
|
|---|
| 511 | <BrowserRouter future={{ v7_startTransition: true }}>
|
|---|
| 512 | <Routes>{/*...*/}</Routes>
|
|---|
| 513 | </BrowserRouter>
|
|---|
| 514 |
|
|---|
| 515 | <RouterProvider router={router} future={{ v7_startTransition: true }}/>
|
|---|
| 516 | ```
|
|---|
| 517 |
|
|---|
| 518 | ### Patch Changes
|
|---|
| 519 |
|
|---|
| 520 | - Work around webpack/terser `React.startTransition` minification bug in production mode ([#10588](https://github.com/remix-run/react-router/pull/10588))
|
|---|
| 521 |
|
|---|
| 522 | ## 6.12.1
|
|---|
| 523 |
|
|---|
| 524 | > \[!WARNING]
|
|---|
| 525 | > Please use version `6.13.0` or later instead of `6.12.1`. This version suffers from a `webpack`/`terser` minification issue resulting in invalid minified code in your resulting production bundles which can cause issues in your application. See [#10579](https://github.com/remix-run/react-router/issues/10579) for more details.
|
|---|
| 526 |
|
|---|
| 527 | ### Patch Changes
|
|---|
| 528 |
|
|---|
| 529 | - Adjust feature detection of `React.startTransition` to fix webpack + react 17 compilation error ([#10569](https://github.com/remix-run/react-router/pull/10569))
|
|---|
| 530 |
|
|---|
| 531 | ## 6.12.0
|
|---|
| 532 |
|
|---|
| 533 | ### Minor Changes
|
|---|
| 534 |
|
|---|
| 535 | - Wrap internal router state updates with `React.startTransition` if it exists ([#10438](https://github.com/remix-run/react-router/pull/10438))
|
|---|
| 536 |
|
|---|
| 537 | ### Patch Changes
|
|---|
| 538 |
|
|---|
| 539 | - Updated dependencies:
|
|---|
| 540 | - `@remix-run/router@1.6.3`
|
|---|
| 541 |
|
|---|
| 542 | ## 6.11.2
|
|---|
| 543 |
|
|---|
| 544 | ### Patch Changes
|
|---|
| 545 |
|
|---|
| 546 | - Fix `basename` duplication in descendant `<Routes>` inside a `<RouterProvider>` ([#10492](https://github.com/remix-run/react-router/pull/10492))
|
|---|
| 547 | - Updated dependencies:
|
|---|
| 548 | - `@remix-run/router@1.6.2`
|
|---|
| 549 |
|
|---|
| 550 | ## 6.11.1
|
|---|
| 551 |
|
|---|
| 552 | ### Patch Changes
|
|---|
| 553 |
|
|---|
| 554 | - Fix usage of `Component` API within descendant `<Routes>` ([#10434](https://github.com/remix-run/react-router/pull/10434))
|
|---|
| 555 | - Fix bug when calling `useNavigate` from `<Routes>` inside a `<RouterProvider>` ([#10432](https://github.com/remix-run/react-router/pull/10432))
|
|---|
| 556 | - Fix usage of `<Navigate>` in strict mode when using a data router ([#10435](https://github.com/remix-run/react-router/pull/10435))
|
|---|
| 557 | - Updated dependencies:
|
|---|
| 558 | - `@remix-run/router@1.6.1`
|
|---|
| 559 |
|
|---|
| 560 | ## 6.11.0
|
|---|
| 561 |
|
|---|
| 562 | ### Patch Changes
|
|---|
| 563 |
|
|---|
| 564 | - Log loader/action errors to the console in dev for easier stack trace evaluation ([#10286](https://github.com/remix-run/react-router/pull/10286))
|
|---|
| 565 | - Fix bug preventing rendering of descendant `<Routes>` when `RouterProvider` errors existed ([#10374](https://github.com/remix-run/react-router/pull/10374))
|
|---|
| 566 | - Fix inadvertent re-renders when using `Component` instead of `element` on a route definition ([#10287](https://github.com/remix-run/react-router/pull/10287))
|
|---|
| 567 | - Fix detection of `useNavigate` in the render cycle by setting the `activeRef` in a layout effect, allowing the `navigate` function to be passed to child components and called in a `useEffect` there. ([#10394](https://github.com/remix-run/react-router/pull/10394))
|
|---|
| 568 | - Switched from `useSyncExternalStore` to `useState` for internal `@remix-run/router` router state syncing in `<RouterProvider>`. We found some [subtle bugs](https://codesandbox.io/s/use-sync-external-store-loop-9g7b81) where router state updates got propagated _before_ other normal `useState` updates, which could lead to footguns in `useEffect` calls. ([#10377](https://github.com/remix-run/react-router/pull/10377), [#10409](https://github.com/remix-run/react-router/pull/10409))
|
|---|
| 569 | - Allow `useRevalidator()` to resolve a loader-driven error boundary scenario ([#10369](https://github.com/remix-run/react-router/pull/10369))
|
|---|
| 570 | - Avoid unnecessary unsubscribe/resubscribes on router state changes ([#10409](https://github.com/remix-run/react-router/pull/10409))
|
|---|
| 571 | - When using a `RouterProvider`, `useNavigate`/`useSubmit`/`fetcher.submit` are now stable across location changes, since we can handle relative routing via the `@remix-run/router` instance and get rid of our dependence on `useLocation()`. When using `BrowserRouter`, these hooks remain unstable across location changes because they still rely on `useLocation()`. ([#10336](https://github.com/remix-run/react-router/pull/10336))
|
|---|
| 572 | - Updated dependencies:
|
|---|
| 573 | - `@remix-run/router@1.6.0`
|
|---|
| 574 |
|
|---|
| 575 | ## 6.10.0
|
|---|
| 576 |
|
|---|
| 577 | ### Minor Changes
|
|---|
| 578 |
|
|---|
| 579 | - Added support for [**Future Flags**](https://reactrouter.com/v6/guides/api-development-strategy) in React Router. The first flag being introduced is `future.v7_normalizeFormMethod` which will normalize the exposed `useNavigation()/useFetcher()` `formMethod` fields as uppercase HTTP methods to align with the `fetch()` behavior. ([#10207](https://github.com/remix-run/react-router/pull/10207))
|
|---|
| 580 |
|
|---|
| 581 | - When `future.v7_normalizeFormMethod === false` (default v6 behavior),
|
|---|
| 582 | - `useNavigation().formMethod` is lowercase
|
|---|
| 583 | - `useFetcher().formMethod` is lowercase
|
|---|
| 584 | - When `future.v7_normalizeFormMethod === true`:
|
|---|
| 585 | - `useNavigation().formMethod` is uppercase
|
|---|
| 586 | - `useFetcher().formMethod` is uppercase
|
|---|
| 587 |
|
|---|
| 588 | ### Patch Changes
|
|---|
| 589 |
|
|---|
| 590 | - Fix route ID generation when using Fragments in `createRoutesFromElements` ([#10193](https://github.com/remix-run/react-router/pull/10193))
|
|---|
| 591 | - Updated dependencies:
|
|---|
| 592 | - `@remix-run/router@1.5.0`
|
|---|
| 593 |
|
|---|
| 594 | ## 6.9.0
|
|---|
| 595 |
|
|---|
| 596 | ### Minor Changes
|
|---|
| 597 |
|
|---|
| 598 | - React Router now supports an alternative way to define your route `element` and `errorElement` fields as React Components instead of React Elements. You can instead pass a React Component to the new `Component` and `ErrorBoundary` fields if you choose. There is no functional difference between the two, so use whichever approach you prefer 😀. You shouldn't be defining both, but if you do `Component`/`ErrorBoundary` will "win". ([#10045](https://github.com/remix-run/react-router/pull/10045))
|
|---|
| 599 |
|
|---|
| 600 | **Example JSON Syntax**
|
|---|
| 601 |
|
|---|
| 602 | ```jsx
|
|---|
| 603 | // Both of these work the same:
|
|---|
| 604 | const elementRoutes = [{
|
|---|
| 605 | path: '/',
|
|---|
| 606 | element: <Home />,
|
|---|
| 607 | errorElement: <HomeError />,
|
|---|
| 608 | }]
|
|---|
| 609 |
|
|---|
| 610 | const componentRoutes = [{
|
|---|
| 611 | path: '/',
|
|---|
| 612 | Component: Home,
|
|---|
| 613 | ErrorBoundary: HomeError,
|
|---|
| 614 | }]
|
|---|
| 615 |
|
|---|
| 616 | function Home() { ... }
|
|---|
| 617 | function HomeError() { ... }
|
|---|
| 618 | ```
|
|---|
| 619 |
|
|---|
| 620 | **Example JSX Syntax**
|
|---|
| 621 |
|
|---|
| 622 | ```jsx
|
|---|
| 623 | // Both of these work the same:
|
|---|
| 624 | const elementRoutes = createRoutesFromElements(
|
|---|
| 625 | <Route path='/' element={<Home />} errorElement={<HomeError /> } />
|
|---|
| 626 | );
|
|---|
| 627 |
|
|---|
| 628 | const componentRoutes = createRoutesFromElements(
|
|---|
| 629 | <Route path='/' Component={Home} ErrorBoundary={HomeError} />
|
|---|
| 630 | );
|
|---|
| 631 |
|
|---|
| 632 | function Home() { ... }
|
|---|
| 633 | function HomeError() { ... }
|
|---|
| 634 | ```
|
|---|
| 635 |
|
|---|
| 636 | - **Introducing Lazy Route Modules!** ([#10045](https://github.com/remix-run/react-router/pull/10045))
|
|---|
| 637 |
|
|---|
| 638 | In order to keep your application bundles small and support code-splitting of your routes, we've introduced a new `lazy()` route property. This is an async function that resolves the non-route-matching portions of your route definition (`loader`, `action`, `element`/`Component`, `errorElement`/`ErrorBoundary`, `shouldRevalidate`, `handle`).
|
|---|
| 639 |
|
|---|
| 640 | Lazy routes are resolved on initial load and during the `loading` or `submitting` phase of a navigation or fetcher call. You cannot lazily define route-matching properties (`path`, `index`, `children`) since we only execute your lazy route functions after we've matched known routes.
|
|---|
| 641 |
|
|---|
| 642 | Your `lazy` functions will typically return the result of a dynamic import.
|
|---|
| 643 |
|
|---|
| 644 | ```jsx
|
|---|
| 645 | // In this example, we assume most folks land on the homepage so we include that
|
|---|
| 646 | // in our critical-path bundle, but then we lazily load modules for /a and /b so
|
|---|
| 647 | // they don't load until the user navigates to those routes
|
|---|
| 648 | let routes = createRoutesFromElements(
|
|---|
| 649 | <Route path="/" element={<Layout />}>
|
|---|
| 650 | <Route index element={<Home />} />
|
|---|
| 651 | <Route path="a" lazy={() => import("./a")} />
|
|---|
| 652 | <Route path="b" lazy={() => import("./b")} />
|
|---|
| 653 | </Route>
|
|---|
| 654 | );
|
|---|
| 655 | ```
|
|---|
| 656 |
|
|---|
| 657 | Then in your lazy route modules, export the properties you want defined for the route:
|
|---|
| 658 |
|
|---|
| 659 | ```jsx
|
|---|
| 660 | export async function loader({ request }) {
|
|---|
| 661 | let data = await fetchData(request);
|
|---|
| 662 | return json(data);
|
|---|
| 663 | }
|
|---|
| 664 |
|
|---|
| 665 | // Export a `Component` directly instead of needing to create a React Element from it
|
|---|
| 666 | export function Component() {
|
|---|
| 667 | let data = useLoaderData();
|
|---|
| 668 |
|
|---|
| 669 | return (
|
|---|
| 670 | <>
|
|---|
| 671 | <h1>You made it!</h1>
|
|---|
| 672 | <p>{data}</p>
|
|---|
| 673 | </>
|
|---|
| 674 | );
|
|---|
| 675 | }
|
|---|
| 676 |
|
|---|
| 677 | // Export an `ErrorBoundary` directly instead of needing to create a React Element from it
|
|---|
| 678 | export function ErrorBoundary() {
|
|---|
| 679 | let error = useRouteError();
|
|---|
| 680 | return isRouteErrorResponse(error) ? (
|
|---|
| 681 | <h1>
|
|---|
| 682 | {error.status} {error.statusText}
|
|---|
| 683 | </h1>
|
|---|
| 684 | ) : (
|
|---|
| 685 | <h1>{error.message || error}</h1>
|
|---|
| 686 | );
|
|---|
| 687 | }
|
|---|
| 688 | ```
|
|---|
| 689 |
|
|---|
| 690 | An example of this in action can be found in the [`examples/lazy-loading-router-provider`](https://github.com/remix-run/react-router/tree/main/examples/lazy-loading-router-provider) directory of the repository.
|
|---|
| 691 |
|
|---|
| 692 | 🙌 Huge thanks to @rossipedia for the [Initial Proposal](https://github.com/remix-run/react-router/discussions/9826) and [POC Implementation](https://github.com/remix-run/react-router/pull/9830).
|
|---|
| 693 |
|
|---|
| 694 | - Updated dependencies:
|
|---|
| 695 | - `@remix-run/router@1.4.0`
|
|---|
| 696 |
|
|---|
| 697 | ### Patch Changes
|
|---|
| 698 |
|
|---|
| 699 | - Fix `generatePath` incorrectly applying parameters in some cases ([#10078](https://github.com/remix-run/react-router/pull/10078))
|
|---|
| 700 | - Improve memoization for context providers to avoid unnecessary re-renders ([#9983](https://github.com/remix-run/react-router/pull/9983))
|
|---|
| 701 |
|
|---|
| 702 | ## 6.8.2
|
|---|
| 703 |
|
|---|
| 704 | ### Patch Changes
|
|---|
| 705 |
|
|---|
| 706 | - Updated dependencies:
|
|---|
| 707 | - `@remix-run/router@1.3.3`
|
|---|
| 708 |
|
|---|
| 709 | ## 6.8.1
|
|---|
| 710 |
|
|---|
| 711 | ### Patch Changes
|
|---|
| 712 |
|
|---|
| 713 | - Remove inaccurate console warning for POP navigations and update active blocker logic ([#10030](https://github.com/remix-run/react-router/pull/10030))
|
|---|
| 714 | - Updated dependencies:
|
|---|
| 715 | - `@remix-run/router@1.3.2`
|
|---|
| 716 |
|
|---|
| 717 | ## 6.8.0
|
|---|
| 718 |
|
|---|
| 719 | ### Patch Changes
|
|---|
| 720 |
|
|---|
| 721 | - Updated dependencies:
|
|---|
| 722 | - `@remix-run/router@1.3.1`
|
|---|
| 723 |
|
|---|
| 724 | ## 6.7.0
|
|---|
| 725 |
|
|---|
| 726 | ### Minor Changes
|
|---|
| 727 |
|
|---|
| 728 | - Add `unstable_useBlocker` hook for blocking navigations within the app's location origin ([#9709](https://github.com/remix-run/react-router/pull/9709))
|
|---|
| 729 |
|
|---|
| 730 | ### Patch Changes
|
|---|
| 731 |
|
|---|
| 732 | - Fix `generatePath` when optional params are present ([#9764](https://github.com/remix-run/react-router/pull/9764))
|
|---|
| 733 | - Update `<Await>` to accept `ReactNode` as children function return result ([#9896](https://github.com/remix-run/react-router/pull/9896))
|
|---|
| 734 | - Updated dependencies:
|
|---|
| 735 | - `@remix-run/router@1.3.0`
|
|---|
| 736 |
|
|---|
| 737 | ## 6.6.2
|
|---|
| 738 |
|
|---|
| 739 | ### Patch Changes
|
|---|
| 740 |
|
|---|
| 741 | - Ensure `useId` consistency during SSR ([#9805](https://github.com/remix-run/react-router/pull/9805))
|
|---|
| 742 |
|
|---|
| 743 | ## 6.6.1
|
|---|
| 744 |
|
|---|
| 745 | ### Patch Changes
|
|---|
| 746 |
|
|---|
| 747 | - Updated dependencies:
|
|---|
| 748 | - `@remix-run/router@1.2.1`
|
|---|
| 749 |
|
|---|
| 750 | ## 6.6.0
|
|---|
| 751 |
|
|---|
| 752 | ### Patch Changes
|
|---|
| 753 |
|
|---|
| 754 | - Prevent `useLoaderData` usage in `errorElement` ([#9735](https://github.com/remix-run/react-router/pull/9735))
|
|---|
| 755 | - Updated dependencies:
|
|---|
| 756 | - `@remix-run/router@1.2.0`
|
|---|
| 757 |
|
|---|
| 758 | ## 6.5.0
|
|---|
| 759 |
|
|---|
| 760 | This release introduces support for [Optional Route Segments](https://github.com/remix-run/react-router/issues/9546). Now, adding a `?` to the end of any path segment will make that entire segment optional. This works for both static segments and dynamic parameters.
|
|---|
| 761 |
|
|---|
| 762 | **Optional Params Examples**
|
|---|
| 763 |
|
|---|
| 764 | - `<Route path=":lang?/about>` will match:
|
|---|
| 765 | - `/:lang/about`
|
|---|
| 766 | - `/about`
|
|---|
| 767 | - `<Route path="/multistep/:widget1?/widget2?/widget3?">` will match:
|
|---|
| 768 | - `/multistep`
|
|---|
| 769 | - `/multistep/:widget1`
|
|---|
| 770 | - `/multistep/:widget1/:widget2`
|
|---|
| 771 | - `/multistep/:widget1/:widget2/:widget3`
|
|---|
| 772 |
|
|---|
| 773 | **Optional Static Segment Example**
|
|---|
| 774 |
|
|---|
| 775 | - `<Route path="/home?">` will match:
|
|---|
| 776 | - `/`
|
|---|
| 777 | - `/home`
|
|---|
| 778 | - `<Route path="/fr?/about">` will match:
|
|---|
| 779 | - `/about`
|
|---|
| 780 | - `/fr/about`
|
|---|
| 781 |
|
|---|
| 782 | ### Minor Changes
|
|---|
| 783 |
|
|---|
| 784 | - Allows optional routes and optional static segments ([#9650](https://github.com/remix-run/react-router/pull/9650))
|
|---|
| 785 |
|
|---|
| 786 | ### Patch Changes
|
|---|
| 787 |
|
|---|
| 788 | - Stop incorrectly matching on partial named parameters, i.e. `<Route path="prefix-:param">`, to align with how splat parameters work. If you were previously relying on this behavior then it's recommended to extract the static portion of the path at the `useParams` call site: ([#9506](https://github.com/remix-run/react-router/pull/9506))
|
|---|
| 789 |
|
|---|
| 790 | ```jsx
|
|---|
| 791 | // Old behavior at URL /prefix-123
|
|---|
| 792 | <Route path="prefix-:id" element={<Comp /> }>
|
|---|
| 793 |
|
|---|
| 794 | function Comp() {
|
|---|
| 795 | let params = useParams(); // { id: '123' }
|
|---|
| 796 | let id = params.id; // "123"
|
|---|
| 797 | ...
|
|---|
| 798 | }
|
|---|
| 799 |
|
|---|
| 800 | // New behavior at URL /prefix-123
|
|---|
| 801 | <Route path=":id" element={<Comp /> }>
|
|---|
| 802 |
|
|---|
| 803 | function Comp() {
|
|---|
| 804 | let params = useParams(); // { id: 'prefix-123' }
|
|---|
| 805 | let id = params.id.replace(/^prefix-/, ''); // "123"
|
|---|
| 806 | ...
|
|---|
| 807 | }
|
|---|
| 808 | ```
|
|---|
| 809 |
|
|---|
| 810 | - Updated dependencies:
|
|---|
| 811 | - `@remix-run/router@1.1.0`
|
|---|
| 812 |
|
|---|
| 813 | ## 6.4.5
|
|---|
| 814 |
|
|---|
| 815 | ### Patch Changes
|
|---|
| 816 |
|
|---|
| 817 | - Updated dependencies:
|
|---|
| 818 | - `@remix-run/router@1.0.5`
|
|---|
| 819 |
|
|---|
| 820 | ## 6.4.4
|
|---|
| 821 |
|
|---|
| 822 | ### Patch Changes
|
|---|
| 823 |
|
|---|
| 824 | - Updated dependencies:
|
|---|
| 825 | - `@remix-run/router@1.0.4`
|
|---|
| 826 |
|
|---|
| 827 | ## 6.4.3
|
|---|
| 828 |
|
|---|
| 829 | ### Patch Changes
|
|---|
| 830 |
|
|---|
| 831 | - `useRoutes` should be able to return `null` when passing `locationArg` ([#9485](https://github.com/remix-run/react-router/pull/9485))
|
|---|
| 832 | - fix `initialEntries` type in `createMemoryRouter` ([#9498](https://github.com/remix-run/react-router/pull/9498))
|
|---|
| 833 | - Updated dependencies:
|
|---|
| 834 | - `@remix-run/router@1.0.3`
|
|---|
| 835 |
|
|---|
| 836 | ## 6.4.2
|
|---|
| 837 |
|
|---|
| 838 | ### Patch Changes
|
|---|
| 839 |
|
|---|
| 840 | - Fix `IndexRouteObject` and `NonIndexRouteObject` types to make `hasErrorElement` optional ([#9394](https://github.com/remix-run/react-router/pull/9394))
|
|---|
| 841 | - Enhance console error messages for invalid usage of data router hooks ([#9311](https://github.com/remix-run/react-router/pull/9311))
|
|---|
| 842 | - If an index route has children, it will result in a runtime error. We have strengthened our `RouteObject`/`RouteProps` types to surface the error in TypeScript. ([#9366](https://github.com/remix-run/react-router/pull/9366))
|
|---|
| 843 | - Updated dependencies:
|
|---|
| 844 | - `@remix-run/router@1.0.2`
|
|---|
| 845 |
|
|---|
| 846 | ## 6.4.1
|
|---|
| 847 |
|
|---|
| 848 | ### Patch Changes
|
|---|
| 849 |
|
|---|
| 850 | - Preserve state from `initialEntries` ([#9288](https://github.com/remix-run/react-router/pull/9288))
|
|---|
| 851 | - Updated dependencies:
|
|---|
| 852 | - `@remix-run/router@1.0.1`
|
|---|
| 853 |
|
|---|
| 854 | ## 6.4.0
|
|---|
| 855 |
|
|---|
| 856 | Whoa this is a big one! `6.4.0` brings all the data loading and mutation APIs over from Remix. Here's a quick high level overview, but it's recommended you go check out the [docs](https://reactrouter.com), especially the [feature overview](https://reactrouter.com/en/6.4.0/start/overview) and the [tutorial](https://reactrouter.com/en/6.4.0/start/tutorial).
|
|---|
| 857 |
|
|---|
| 858 | **New APIs**
|
|---|
| 859 |
|
|---|
| 860 | - Create your router with `createMemoryRouter`
|
|---|
| 861 | - Render your router with `<RouterProvider>`
|
|---|
| 862 | - Load data with a Route `loader` and mutate with a Route `action`
|
|---|
| 863 | - Handle errors with Route `errorElement`
|
|---|
| 864 | - Defer non-critical data with `defer` and `Await`
|
|---|
| 865 |
|
|---|
| 866 | **Bug Fixes**
|
|---|
| 867 |
|
|---|
| 868 | - Path resolution is now trailing slash agnostic (#8861)
|
|---|
| 869 | - `useLocation` returns the scoped location inside a `<Routes location>` component (#9094)
|
|---|
| 870 |
|
|---|
| 871 | **Updated Dependencies**
|
|---|
| 872 |
|
|---|
| 873 | - `@remix-run/router@1.0.0`
|
|---|