source: imaps-frontend/node_modules/react-router-dom/CHANGELOG.md@ 0c6b92a

main
Last change on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 40.6 KB
RevLine 
[d565449]1# `react-router-dom`
2
[0c6b92a]3## 6.28.0
4
5### Minor Changes
6
7- - Log deprecation warnings for v7 flags ([#11750](https://github.com/remix-run/react-router/pull/11750))
8 - Add deprecation warnings to `json`/`defer` in favor of returning raw objects
9 - These methods will be removed in React Router v7
10
11### Patch Changes
12
13- Update JSDoc URLs for new website structure (add /v6/ segment) ([#12141](https://github.com/remix-run/react-router/pull/12141))
14- Updated dependencies:
15 - `react-router@6.28.0`
16 - `@remix-run/router@1.21.0`
17
18## 6.27.0
19
20### Minor Changes
21
22- Stabilize `unstable_patchRoutesOnNavigation` ([#11973](https://github.com/remix-run/react-router/pull/11973))
23 - Add new `PatchRoutesOnNavigationFunctionArgs` type for convenience ([#11967](https://github.com/remix-run/react-router/pull/11967))
24- Stabilize `unstable_dataStrategy` ([#11974](https://github.com/remix-run/react-router/pull/11974))
25- Stabilize the `unstable_flushSync` option for navigations and fetchers ([#11989](https://github.com/remix-run/react-router/pull/11989))
26- Stabilize the `unstable_viewTransition` option for navigations and the corresponding `unstable_useViewTransitionState` hook ([#11989](https://github.com/remix-run/react-router/pull/11989))
27
28### Patch Changes
29
30- 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))
31
32- 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))
33
34- 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))
35
36- Updated dependencies:
37 - `react-router@6.27.0`
38 - `@remix-run/router@1.20.0`
39
40## 6.26.2
41
42### Patch Changes
43
44- Updated dependencies:
45 - `@remix-run/router@1.19.2`
46 - `react-router@6.26.2`
47
48## 6.26.1
49
50### Patch Changes
51
52- Rename `unstable_patchRoutesOnMiss` to `unstable_patchRoutesOnNavigation` to match new behavior ([#11888](https://github.com/remix-run/react-router/pull/11888))
53- Updated dependencies:
54 - `@remix-run/router@1.19.1`
55 - `react-router@6.26.1`
56
[d565449]57## 6.26.0
58
59### Minor Changes
60
61- 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))
62
63### Patch Changes
64
65- Fix initial hydration behavior when using `future.v7_partialHydration` along with `unstable_patchRoutesOnMiss` ([#11838](https://github.com/remix-run/react-router/pull/11838))
66 - During initial hydration, `router.state.matches` will now include any partial matches so that we can render ancestor `HydrateFallback` components
67- Updated dependencies:
68 - `@remix-run/router@1.19.0`
69 - `react-router@6.26.0`
70
71## 6.25.1
72
73### Patch Changes
74
75- Memoize some `RouterProvider` internals to reduce unnecessary re-renders ([#11803](https://github.com/remix-run/react-router/pull/11803))
76- Updated dependencies:
77 - `react-router@6.25.1`
78
79## 6.25.0
80
81### Minor Changes
82
83- Stabilize `future.unstable_skipActionErrorRevalidation` as `future.v7_skipActionErrorRevalidation` ([#11769](https://github.com/remix-run/react-router/pull/11769))
84 - When this flag is enabled, actions will not automatically trigger a revalidation if they return/throw a `Response` with a `4xx`/`5xx` status code
85 - You may still opt-into revalidation via `shouldRevalidate`
86 - This also changes `shouldRevalidate`'s `unstable_actionStatus` parameter to `actionStatus`
87
88### Patch Changes
89
90- Updated dependencies:
91 - `react-router@6.25.0`
92 - `@remix-run/router@1.18.0`
93
94## 6.24.1
95
96### Patch Changes
97
98- Remove `polyfill.io` reference from warning message because the domain was sold and has since been determined to serve malware ([#11741](https://github.com/remix-run/react-router/pull/11741))
99 - See <https://sansec.io/research/polyfill-supply-chain-attack>
100- Export `NavLinkRenderProps` type for easier typing of custom `NavLink` callback ([#11553](https://github.com/remix-run/react-router/pull/11553))
101- Updated dependencies:
102 - `@remix-run/router@1.17.1`
103 - `react-router@6.24.1`
104
105## 6.24.0
106
107### Minor Changes
108
109- Add support for Lazy Route Discovery (a.k.a. Fog of War) ([#11626](https://github.com/remix-run/react-router/pull/11626))
110 - RFC: <https://github.com/remix-run/react-router/discussions/11113>
[0c6b92a]111 - `unstable_patchRoutesOnMiss` docs: <https://reactrouter.com/v6/routers/create-browser-router>
[d565449]112
113### Patch Changes
114
115- Fix `fetcher.submit` types - remove incorrect `navigate`/`fetcherKey`/`unstable_viewTransition` options because they are only relevant for `useSubmit` ([#11631](https://github.com/remix-run/react-router/pull/11631))
116- Allow falsy `location.state` values passed to `<StaticRouter>` ([#11495](https://github.com/remix-run/react-router/pull/11495))
117- Updated dependencies:
118 - `react-router@6.24.0`
119 - `@remix-run/router@1.17.0`
120
121## 6.23.1
122
123### Patch Changes
124
125- Check for `document` existence when checking `startViewTransition` ([#11544](https://github.com/remix-run/react-router/pull/11544))
126- Change the `react-router-dom/server` import back to `react-router-dom` instead of `index.ts` ([#11514](https://github.com/remix-run/react-router/pull/11514))
127- Updated dependencies:
128 - `@remix-run/router@1.16.1`
129 - `react-router@6.23.1`
130
131## 6.23.0
132
133### Minor Changes
134
135- Add a new `unstable_dataStrategy` configuration option ([#11098](https://github.com/remix-run/react-router/pull/11098))
136 - This option allows Data Router applications to take control over the approach for executing route loaders and actions
137 - 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
138
139### Patch Changes
140
141- Updated dependencies:
142 - `@remix-run/router@1.16.0`
143 - `react-router@6.23.0`
144
145## 6.22.3
146
147### Patch Changes
148
149- Updated dependencies:
150 - `@remix-run/router@1.15.3`
151 - `react-router@6.22.3`
152
153## 6.22.2
154
155### Patch Changes
156
157- Updated dependencies:
158 - `@remix-run/router@1.15.2`
159 - `react-router@6.22.2`
160
161## 6.22.1
162
163### Patch Changes
164
165- Updated dependencies:
166 - `react-router@6.22.1`
167 - `@remix-run/router@1.15.1`
168
169## 6.22.0
170
171### Minor Changes
172
173- Include a `window__reactRouterVersion` tag for CWV Report detection ([#11222](https://github.com/remix-run/react-router/pull/11222))
174
175### Patch Changes
176
177- Updated dependencies:
178 - `@remix-run/router@1.15.0`
179 - `react-router@6.22.0`
180
181## 6.21.3
182
183### Patch Changes
184
185- Fix `NavLink` `isPending` when a `basename` is used ([#11195](https://github.com/remix-run/react-router/pull/11195))
186- Remove leftover `unstable_` prefix from `Blocker`/`BlockerFunction` types ([#11187](https://github.com/remix-run/react-router/pull/11187))
187- Updated dependencies:
188 - `react-router@6.21.3`
189
190## 6.21.2
191
192### Patch Changes
193
194- Leverage `useId` for internal fetcher keys when available ([#11166](https://github.com/remix-run/react-router/pull/11166))
195- Updated dependencies:
196 - `@remix-run/router@1.14.2`
197 - `react-router@6.21.2`
198
199## 6.21.1
200
201### Patch Changes
202
203- Updated dependencies:
204 - `react-router@6.21.1`
205 - `@remix-run/router@1.14.1`
206
207## 6.21.0
208
209### Minor Changes
210
211- 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))
212
213 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))
214
215 **The Bug**
216 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.
217
218 **The Background**
219 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:
220
221 ```jsx
222 <BrowserRouter>
223 <Routes>
224 <Route path="/" element={<Home />} />
225 <Route path="dashboard/*" element={<Dashboard />} />
226 </Routes>
227 </BrowserRouter>
228 ```
229
230 Any paths like `/dashboard`, `/dashboard/team`, `/dashboard/projects` will match the `Dashboard` route. The dashboard component itself can then render nested `<Routes>`:
231
232 ```jsx
233 function Dashboard() {
234 return (
235 <div>
236 <h2>Dashboard</h2>
237 <nav>
238 <Link to="/">Dashboard Home</Link>
239 <Link to="team">Team</Link>
240 <Link to="projects">Projects</Link>
241 </nav>
242
243 <Routes>
244 <Route path="/" element={<DashboardHome />} />
245 <Route path="team" element={<DashboardTeam />} />
246 <Route path="projects" element={<DashboardProjects />} />
247 </Routes>
248 </div>
249 );
250 }
251 ```
252
253 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.
254
255 **The Problem**
256
257 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 `"."`:
258
259 ```jsx
260 // If we are on URL /dashboard/team, and we want to link to /dashboard/team:
261 function DashboardTeam() {
262 // ❌ This is broken and results in <a href="/dashboard">
263 return <Link to=".">A broken link to the Current URL</Link>;
264
265 // ✅ This is fixed but super unintuitive since we're already at /dashboard/team!
266 return <Link to="./team">A broken link to the Current URL</Link>;
267 }
268 ```
269
270 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.
271
272 Even worse, consider a nested splat route configuration:
273
274 ```jsx
275 <BrowserRouter>
276 <Routes>
277 <Route path="dashboard">
278 <Route path="*" element={<Dashboard />} />
279 </Route>
280 </Routes>
281 </BrowserRouter>
282 ```
283
284 Now, a `<Link to=".">` and a `<Link to="..">` inside the `Dashboard` component go to the same place! That is definitely not correct!
285
286 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:
287
288 ```jsx
289 let router = createBrowserRouter({
290 path: "/dashboard",
291 children: [
292 {
293 path: "*",
294 action: dashboardAction,
295 Component() {
296 // ❌ This form is broken! It throws a 405 error when it submits because
297 // it tries to submit to /dashboard (without the splat value) and the parent
298 // `/dashboard` route doesn't have an action
299 return <Form method="post">...</Form>;
300 },
301 },
302 ],
303 });
304 ```
305
306 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.
307
308 **The Solution**
309 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:
310
311 ```jsx
312 <BrowserRouter>
313 <Routes>
314 <Route path="dashboard">
315 <Route index path="*" element={<Dashboard />} />
316 </Route>
317 </Routes>
318 </BrowserRouter>
319
320 function Dashboard() {
321 return (
322 <div>
323 <h2>Dashboard</h2>
324 <nav>
325 <Link to="..">Dashboard Home</Link>
326 <Link to="../team">Team</Link>
327 <Link to="../projects">Projects</Link>
328 </nav>
329
330 <Routes>
331 <Route path="/" element={<DashboardHome />} />
332 <Route path="team" element={<DashboardTeam />} />
333 <Route path="projects" element={<DashboardProjects />} />
334 </Router>
335 </div>
336 );
337 }
338 ```
339
340 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".
341
342### Patch Changes
343
344- Updated dependencies:
345 - `@remix-run/router@1.14.0`
346 - `react-router@6.21.0`
347
348## 6.20.1
349
350### Patch Changes
351
352- 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))
353- Updated dependencies:
354 - `react-router@6.20.1`
355 - `@remix-run/router@1.13.1`
356
357## 6.20.0
358
359### Minor Changes
360
361- Export the `PathParam` type from the public API ([#10719](https://github.com/remix-run/react-router/pull/10719))
362
363### Patch Changes
364
365- Updated dependencies:
366 - `react-router@6.20.0`
367 - `@remix-run/router@1.13.0`
368
369## 6.19.0
370
371### Minor Changes
372
373- 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))
374- Allow `unstable_usePrompt` to accept a `BlockerFunction` in addition to a `boolean` ([#10991](https://github.com/remix-run/react-router/pull/10991))
375
376### Patch Changes
377
378- Fix issue where a changing fetcher `key` in a `useFetcher` that remains mounted wasn't getting picked up ([#11009](https://github.com/remix-run/react-router/pull/11009))
379- Fix `useFormAction` which was incorrectly inheriting the `?index` query param from child route `action` submissions ([#11025](https://github.com/remix-run/react-router/pull/11025))
380- Fix `NavLink` `active` logic when `to` location has a trailing slash ([#10734](https://github.com/remix-run/react-router/pull/10734))
381- Updated dependencies:
382 - `react-router@6.19.0`
383 - `@remix-run/router@1.12.0`
384
385## 6.18.0
386
387### Minor Changes
388
389- Add support for manual fetcher key specification via `useFetcher({ key: string })` so you can access the same fetcher instance from different components in your application without prop-drilling ([RFC](https://github.com/remix-run/remix/discussions/7698)) ([#10960](https://github.com/remix-run/react-router/pull/10960))
390
391 - Fetcher keys are now also exposed on the fetchers returned from `useFetchers` so that they can be looked up by `key`
392
393- Add `navigate`/`fetcherKey` params/props to `useSumbit`/`Form` to support kicking off a fetcher submission under the hood with an optionally user-specified `key` ([#10960](https://github.com/remix-run/react-router/pull/10960))
394
395 - Invoking a fetcher in this way is ephemeral and stateless
396 - If you need to access the state of one of these fetchers, you will need to leverage `useFetcher({ key })` to look it up elsewhere
397
398### Patch Changes
399
400- Adds a fetcher context to `RouterProvider` that holds completed fetcher data, in preparation for the upcoming future flag that will change the fetcher persistence/cleanup behavior ([#10961](https://github.com/remix-run/react-router/pull/10961))
401- 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))
402- Updated dependencies:
403 - `@remix-run/router@1.11.0`
404 - `react-router@6.18.0`
405
406## 6.17.0
407
408### Minor Changes
409
410- Add experimental support for the [View Transitions API](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition) via `document.startViewTransition` to enable CSS animated transitions on SPA navigations in your application. ([#10916](https://github.com/remix-run/react-router/pull/10916))
411
412 The simplest approach to enabling a View Transition in your React Router app is via the new `<Link unstable_viewTransition>` prop. This will cause the navigation DOM update to be wrapped in `document.startViewTransition` which will enable transitions for the DOM update. Without any additional CSS styles, you'll get a basic cross-fade animation for your page.
413
414 If you need to apply more fine-grained styles for your animations, you can leverage the `unstable_useViewTransitionState` hook which will tell you when a transition is in progress and you can use that to apply classes or styles:
415
416 ```jsx
417 function ImageLink(to, src, alt) {
418 let isTransitioning = unstable_useViewTransitionState(to);
419 return (
420 <Link to={to} unstable_viewTransition>
421 <img
422 src={src}
423 alt={alt}
424 style={{
425 viewTransitionName: isTransitioning ? "image-expand" : "",
426 }}
427 />
428 </Link>
429 );
430 }
431 ```
432
433 You can also use the `<NavLink unstable_viewTransition>` shorthand which will manage the hook usage for you and automatically add a `transitioning` class to the `<a>` during the transition:
434
435 ```css
436 a.transitioning img {
437 view-transition-name: "image-expand";
438 }
439 ```
440
441 ```jsx
442 <NavLink to={to} unstable_viewTransition>
443 <img src={src} alt={alt} />
444 </NavLink>
445 ```
446
447 For an example usage of View Transitions with React Router, check out [our fork](https://github.com/brophdawg11/react-router-records) of the [Astro Records](https://github.com/Charca/astro-records) demo.
448
449 For more information on using the View Transitions API, please refer to the [Smooth and simple transitions with the View Transitions API](https://developer.chrome.com/docs/web-platform/view-transitions/) guide from the Google Chrome team.
450
451 Please note, that because the `ViewTransition` API is a DOM API, we now export a specific `RouterProvider` from `react-router-dom` with this functionality. If you are importing `RouterProvider` from `react-router`, then it will not support view transitions. ([#10928](https://github.com/remix-run/react-router/pull/10928)
452
453### Patch Changes
454
455- Log a warning and fail gracefully in `ScrollRestoration` when `sessionStorage` is unavailable ([#10848](https://github.com/remix-run/react-router/pull/10848))
456- Updated dependencies:
457 - `@remix-run/router@1.10.0`
458 - `react-router@6.17.0`
459
460## 6.16.0
461
462### Minor Changes
463
464- Updated dependencies:
465 - `@remix-run/router@1.9.0`
466 - `react-router@6.16.0`
467
468### Patch Changes
469
470- Properly encode rendered URIs in server rendering to avoid hydration errors ([#10769](https://github.com/remix-run/react-router/pull/10769))
471
472## 6.15.0
473
474### Minor Changes
475
476- 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))
477
478### Patch Changes
479
480- Fixes an edge-case affecting web extensions in Firefox that use `URLSearchParams` and the `useSearchParams` hook. ([#10620](https://github.com/remix-run/react-router/pull/10620))
481- Do not include hash in `useFormAction()` for unspecified actions since it cannot be determined on the server and causes hydration issues ([#10758](https://github.com/remix-run/react-router/pull/10758))
482- Reorder effects in `unstable_usePrompt` to avoid throwing an exception if the prompt is unblocked and a navigation is performed synchronously ([#10687](https://github.com/remix-run/react-router/pull/10687), [#10718](https://github.com/remix-run/react-router/pull/10718))
483- Updated dependencies:
484 - `@remix-run/router@1.8.0`
485 - `react-router@6.15.0`
486
487## 6.14.2
488
489### Patch Changes
490
491- Properly decode element id when emulating hash scrolling via `<ScrollRestoration>` ([#10682](https://github.com/remix-run/react-router/pull/10682))
492- Add missing `<Form state>` prop to populate `history.state` on submission navigations ([#10630](https://github.com/remix-run/react-router/pull/10630))
493- Support proper hydration of `Error` subclasses such as `ReferenceError`/`TypeError` ([#10633](https://github.com/remix-run/react-router/pull/10633))
494- Updated dependencies:
495 - `@remix-run/router@1.7.2`
496 - `react-router@6.14.2`
497
498## 6.14.1
499
500### Patch Changes
501
502- Updated dependencies:
503 - `react-router@6.14.1`
504 - `@remix-run/router@1.7.1`
505
506## 6.14.0
507
508### Minor Changes
509
510- Add support for `application/json` and `text/plain` encodings for `useSubmit`/`fetcher.submit`. To reflect these additional types, `useNavigation`/`useFetcher` now also contain `navigation.json`/`navigation.text` and `fetcher.json`/`fetcher.text` which include the json/text submission if applicable ([#10413](https://github.com/remix-run/react-router/pull/10413))
511
512 ```jsx
513 // The default behavior will still serialize as FormData
514 function Component() {
515 let navigation = useNavigation();
516 let submit = useSubmit();
517 submit({ key: "value" }, { method: "post" });
518 // navigation.formEncType => "application/x-www-form-urlencoded"
519 // navigation.formData => FormData instance
520 }
521
522 async function action({ request }) {
523 // request.headers.get("Content-Type") => "application/x-www-form-urlencoded"
524 // await request.formData() => FormData instance
525 }
526 ```
527
528 ```js
529 // Opt-into JSON encoding with `encType: "application/json"`
530 function Component() {
531 let navigation = useNavigation();
532 let submit = useSubmit();
533 submit({ key: "value" }, { method: "post", encType: "application/json" });
534 // navigation.formEncType => "application/json"
535 // navigation.json => { key: "value" }
536 }
537
538 async function action({ request }) {
539 // request.headers.get("Content-Type") => "application/json"
540 // await request.json() => { key: "value" }
541 }
542 ```
543
544 ```js
545 // Opt-into text encoding with `encType: "text/plain"`
546 function Component() {
547 let navigation = useNavigation();
548 let submit = useSubmit();
549 submit("Text submission", { method: "post", encType: "text/plain" });
550 // navigation.formEncType => "text/plain"
551 // navigation.text => "Text submission"
552 }
553
554 async function action({ request }) {
555 // request.headers.get("Content-Type") => "text/plain"
556 // await request.text() => "Text submission"
557 }
558 ```
559
560### Patch Changes
561
562- When submitting a form from a `submitter` element, prefer the built-in `new FormData(form, submitter)` instead of the previous manual approach in modern browsers (those that support the new `submitter` parameter) ([#9865](https://github.com/remix-run/react-router/pull/9865), [#10627](https://github.com/remix-run/react-router/pull/10627))
563 - For browsers that don't support it, we continue to just append the submit button's entry to the end, and we also add rudimentary support for `type="image"` buttons
564 - If developers want full spec-compliant support for legacy browsers, they can use the `formdata-submitter-polyfill`
565- Call `window.history.pushState/replaceState` before updating React Router state (instead of after) so that `window.location` matches `useLocation` during synchronous React 17 rendering ([#10448](https://github.com/remix-run/react-router/pull/10448))
566 - ⚠️ However, generally apps should not be relying on `window.location` and should always reference `useLocation` when possible, as `window.location` will not be in sync 100% of the time (due to `popstate` events, concurrent mode, etc.)
567- Fix `tsc --skipLibCheck:false` issues on React 17 ([#10622](https://github.com/remix-run/react-router/pull/10622))
568- Upgrade `typescript` to 5.1 ([#10581](https://github.com/remix-run/react-router/pull/10581))
569- Updated dependencies:
570 - `react-router@6.14.0`
571 - `@remix-run/router@1.7.0`
572
573## 6.13.0
574
575### Minor Changes
576
[0c6b92a]577- 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))
[d565449]578
579 Existing behavior will no longer include `React.startTransition`:
580
581 ```jsx
582 <BrowserRouter>
583 <Routes>{/*...*/}</Routes>
584 </BrowserRouter>
585
586 <RouterProvider router={router} />
587 ```
588
589 If you wish to enable `React.startTransition`, pass the future flag to your component:
590
591 ```jsx
592 <BrowserRouter future={{ v7_startTransition: true }}>
593 <Routes>{/*...*/}</Routes>
594 </BrowserRouter>
595
596 <RouterProvider router={router} future={{ v7_startTransition: true }}/>
597 ```
598
599### Patch Changes
600
601- Work around webpack/terser `React.startTransition` minification bug in production mode ([#10588](https://github.com/remix-run/react-router/pull/10588))
602- Updated dependencies:
603 - `react-router@6.13.0`
604
605## 6.12.1
606
607> \[!WARNING]
608> 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.
609
610### Patch Changes
611
612- Adjust feature detection of `React.startTransition` to fix webpack + react 17 compilation error ([#10569](https://github.com/remix-run/react-router/pull/10569))
613- Updated dependencies:
614 - `react-router@6.12.1`
615
616## 6.12.0
617
618### Minor Changes
619
620- Wrap internal router state updates with `React.startTransition` if it exists ([#10438](https://github.com/remix-run/react-router/pull/10438))
621
622### Patch Changes
623
624- Re-throw `DOMException` (`DataCloneError`) when attempting to perform a `PUSH` navigation with non-serializable state. ([#10427](https://github.com/remix-run/react-router/pull/10427))
625- Updated dependencies:
626 - `@remix-run/router@1.6.3`
627 - `react-router@6.12.0`
628
629## 6.11.2
630
631### Patch Changes
632
633- Export `SetURLSearchParams` type ([#10444](https://github.com/remix-run/react-router/pull/10444))
634- Updated dependencies:
635 - `react-router@6.11.2`
636 - `@remix-run/router@1.6.2`
637
638## 6.11.1
639
640### Patch Changes
641
642- Updated dependencies:
643 - `react-router@6.11.1`
644 - `@remix-run/router@1.6.1`
645
646## 6.11.0
647
648### Minor Changes
649
650- Enable `basename` support in `useFetcher` ([#10336](https://github.com/remix-run/react-router/pull/10336))
651 - If you were previously working around this issue by manually prepending the `basename` then you will need to remove the manually prepended `basename` from your `fetcher` calls (`fetcher.load('/basename/route') -> fetcher.load('/route')`)
652
653### Patch Changes
654
655- Fix inadvertent re-renders when using `Component` instead of `element` on a route definition ([#10287](https://github.com/remix-run/react-router/pull/10287))
656- Fail gracefully on `<Link to="//">` and other invalid URL values ([#10367](https://github.com/remix-run/react-router/pull/10367))
657- 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))
658- Add static prop to `StaticRouterProvider`'s internal `Router` component ([#10401](https://github.com/remix-run/react-router/pull/10401))
659- 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))
660- Updated dependencies:
661 - `react-router@6.11.0`
662 - `@remix-run/router@1.6.0`
663
664## 6.10.0
665
666### Minor Changes
667
[0c6b92a]668- 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))
[d565449]669
670 - When `future.v7_normalizeFormMethod === false` (default v6 behavior),
671 - `useNavigation().formMethod` is lowercase
672 - `useFetcher().formMethod` is lowercase
673 - When `future.v7_normalizeFormMethod === true`:
674 - `useNavigation().formMethod` is uppercase
675 - `useFetcher().formMethod` is uppercase
676
677### Patch Changes
678
679- Fix `createStaticHandler` to also check for `ErrorBoundary` on routes in addition to `errorElement` ([#10190](https://github.com/remix-run/react-router/pull/10190))
680- Updated dependencies:
681 - `@remix-run/router@1.5.0`
682 - `react-router@6.10.0`
683
684## 6.9.0
685
686### Minor Changes
687
688- 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))
689
690 **Example JSON Syntax**
691
692 ```jsx
693 // Both of these work the same:
694 const elementRoutes = [{
695 path: '/',
696 element: <Home />,
697 errorElement: <HomeError />,
698 }]
699
700 const componentRoutes = [{
701 path: '/',
702 Component: Home,
703 ErrorBoundary: HomeError,
704 }]
705
706 function Home() { ... }
707 function HomeError() { ... }
708 ```
709
710 **Example JSX Syntax**
711
712 ```jsx
713 // Both of these work the same:
714 const elementRoutes = createRoutesFromElements(
715 <Route path='/' element={<Home />} errorElement={<HomeError /> } />
716 );
717
718 const componentRoutes = createRoutesFromElements(
719 <Route path='/' Component={Home} ErrorBoundary={HomeError} />
720 );
721
722 function Home() { ... }
723 function HomeError() { ... }
724 ```
725
726- **Introducing Lazy Route Modules!** ([#10045](https://github.com/remix-run/react-router/pull/10045))
727
728 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`).
729
730 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.
731
732 Your `lazy` functions will typically return the result of a dynamic import.
733
734 ```jsx
735 // In this example, we assume most folks land on the homepage so we include that
736 // in our critical-path bundle, but then we lazily load modules for /a and /b so
737 // they don't load until the user navigates to those routes
738 let routes = createRoutesFromElements(
739 <Route path="/" element={<Layout />}>
740 <Route index element={<Home />} />
741 <Route path="a" lazy={() => import("./a")} />
742 <Route path="b" lazy={() => import("./b")} />
743 </Route>
744 );
745 ```
746
747 Then in your lazy route modules, export the properties you want defined for the route:
748
749 ```jsx
750 export async function loader({ request }) {
751 let data = await fetchData(request);
752 return json(data);
753 }
754
755 // Export a `Component` directly instead of needing to create a React Element from it
756 export function Component() {
757 let data = useLoaderData();
758
759 return (
760 <>
761 <h1>You made it!</h1>
762 <p>{data}</p>
763 </>
764 );
765 }
766
767 // Export an `ErrorBoundary` directly instead of needing to create a React Element from it
768 export function ErrorBoundary() {
769 let error = useRouteError();
770 return isRouteErrorResponse(error) ? (
771 <h1>
772 {error.status} {error.statusText}
773 </h1>
774 ) : (
775 <h1>{error.message || error}</h1>
776 );
777 }
778 ```
779
780 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.
781
782 🙌 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).
783
784- Updated dependencies:
785 - `react-router@6.9.0`
786 - `@remix-run/router@1.4.0`
787
788## 6.8.2
789
790### Patch Changes
791
792- Treat same-origin absolute URLs in `<Link to>` as external if they are outside of the router `basename` ([#10135](https://github.com/remix-run/react-router/pull/10135))
793- Fix `useBlocker` to return `IDLE_BLOCKER` during SSR ([#10046](https://github.com/remix-run/react-router/pull/10046))
794- Fix SSR of absolute `<Link to>` urls ([#10112](https://github.com/remix-run/react-router/pull/10112))
795- Properly escape HTML characters in `StaticRouterProvider` serialized hydration data ([#10068](https://github.com/remix-run/react-router/pull/10068))
796- Updated dependencies:
797 - `@remix-run/router@1.3.3`
798 - `react-router@6.8.2`
799
800## 6.8.1
801
802### Patch Changes
803
804- Improved absolute url detection in `Link` component (now also supports `mailto:` urls) ([#9994](https://github.com/remix-run/react-router/pull/9994))
805- Fix partial object (search or hash only) pathnames losing current path value ([#10029](https://github.com/remix-run/react-router/pull/10029))
806- Updated dependencies:
807 - `react-router@6.8.1`
808 - `@remix-run/router@1.3.2`
809
810## 6.8.0
811
812### Minor Changes
813
814- Support absolute URLs in `<Link to>`. If the URL is for the current origin, it will still do a client-side navigation. If the URL is for a different origin then it will do a fresh document request for the new origin. ([#9900](https://github.com/remix-run/react-router/pull/9900))
815
816 ```tsx
817 <Link to="https://neworigin.com/some/path"> {/* Document request */}
818 <Link to="//neworigin.com/some/path"> {/* Document request */}
819 <Link to="https://www.currentorigin.com/path"> {/* Client-side navigation */}
820 ```
821
822### Patch Changes
823
824- Fix bug with search params removal via `useSearchParams` ([#9969](https://github.com/remix-run/react-router/pull/9969))
825- Respect `preventScrollReset` on `<fetcher.Form>` ([#9963](https://github.com/remix-run/react-router/pull/9963))
826- Fix navigation for hash routers on manual URL changes ([#9980](https://github.com/remix-run/react-router/pull/9980))
827- Use `pagehide` instead of `beforeunload` for `<ScrollRestoration>`. This has better cross-browser support, specifically on Mobile Safari. ([#9945](https://github.com/remix-run/react-router/pull/9945))
828- Updated dependencies:
829 - `@remix-run/router@1.3.1`
830 - `react-router@6.8.0`
831
832## 6.7.0
833
834### Minor Changes
835
836- Add `unstable_useBlocker` hook for blocking navigations within the app's location origin ([#9709](https://github.com/remix-run/react-router/pull/9709))
837- Add `unstable_usePrompt` hook for blocking navigations within the app's location origin ([#9932](https://github.com/remix-run/react-router/pull/9932))
838- Add `preventScrollReset` prop to `<Form>` ([#9886](https://github.com/remix-run/react-router/pull/9886))
839
840### Patch Changes
841
842- Added pass-through event listener options argument to `useBeforeUnload` ([#9709](https://github.com/remix-run/react-router/pull/9709))
843- Streamline jsdom bug workaround in tests ([#9824](https://github.com/remix-run/react-router/pull/9824))
844- Updated dependencies:
845 - `@remix-run/router@1.3.0`
846 - `react-router@6.7.0`
847
848## 6.6.2
849
850### Patch Changes
851
852- Ensure `useId` consistency during SSR ([#9805](https://github.com/remix-run/react-router/pull/9805))
853- Updated dependencies:
854 - `react-router@6.6.2`
855
856## 6.6.1
857
858### Patch Changes
859
860- Updated dependencies:
861 - `@remix-run/router@1.2.1`
862 - `react-router@6.6.1`
863
864## 6.6.0
865
866### Minor Changes
867
868- Add `useBeforeUnload()` hook ([#9664](https://github.com/remix-run/react-router/pull/9664))
869- Remove `unstable_` prefix from `createStaticHandler`/`createStaticRouter`/`StaticRouterProvider` ([#9738](https://github.com/remix-run/react-router/pull/9738))
870
871### Patch Changes
872
873- Proper hydration of `Error` objects from `StaticRouterProvider` ([#9664](https://github.com/remix-run/react-router/pull/9664))
874- Support uppercase `<Form method>` and `useSubmit` method values ([#9664](https://github.com/remix-run/react-router/pull/9664))
875- Skip initial scroll restoration for SSR apps with `hydrationData` ([#9664](https://github.com/remix-run/react-router/pull/9664))
876- Fix `<button formmethod>` form submission overriddes ([#9664](https://github.com/remix-run/react-router/pull/9664))
877- Updated dependencies:
878 - `@remix-run/router@1.2.0`
879 - `react-router@6.6.0`
880
881## 6.5.0
882
883### Patch Changes
884
885- Updated dependencies:
886 - `react-router@6.5.0`
887 - `@remix-run/router@1.1.0`
888
889## 6.4.5
890
891### Patch Changes
892
893- Updated dependencies:
894 - `@remix-run/router@1.0.5`
895 - `react-router@6.4.5`
896
897## 6.4.4
898
899### Patch Changes
900
901- Fix issues with encoded characters in `NavLink` and descendant `<Routes>` ([#9589](https://github.com/remix-run/react-router/pull/9589), [#9647](https://github.com/remix-run/react-router/pull/9647))
902- Properly serialize/deserialize `ErrorResponse` instances when using built-in hydration ([#9593](https://github.com/remix-run/react-router/pull/9593))
903- Support `basename` in static data routers ([#9591](https://github.com/remix-run/react-router/pull/9591))
904- Updated dependencies:
905 - `@remix-run/router@1.0.4`
906 - `react-router@6.4.4`
907
908## 6.4.3
909
910### Patch Changes
911
912- Fix hrefs generated for `createHashRouter` ([#9409](https://github.com/remix-run/react-router/pull/9409))
913- fix encoding/matching issues with special chars ([#9477](https://github.com/remix-run/react-router/pull/9477), [#9496](https://github.com/remix-run/react-router/pull/9496))
914- Properly support `index` routes with a `path` in `useResolvedPath` ([#9486](https://github.com/remix-run/react-router/pull/9486))
915- Respect `relative=path` prop on `NavLink` ([#9453](https://github.com/remix-run/react-router/pull/9453))
916- Fix `NavLink` behavior for root urls ([#9497](https://github.com/remix-run/react-router/pull/9497))
917- Updated dependencies:
918 - `@remix-run/router@1.0.3`
919 - `react-router@6.4.3`
920
921## 6.4.2
922
923### Patch Changes
924
925- Respect `basename` in `useFormAction` ([#9352](https://github.com/remix-run/react-router/pull/9352))
926- Enhance console error messages for invalid usage of data router hooks ([#9311](https://github.com/remix-run/react-router/pull/9311))
927- 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))
928- Updated dependencies:
929 - `react-router@6.4.2`
930 - `@remix-run/router@1.0.2`
931
932## 6.4.1
933
934### Patch Changes
935
936- Updated dependencies:
937 - `react-router@6.4.1`
938 - `@remix-run/router@1.0.1`
939
940## 6.4.0
941
[0c6b92a]942Whoa 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).
[d565449]943
944**New APIs**
945
946- Create your router with `createMemoryRouter`/`createBrowserRouter`/`createHashRouter`
947- Render your router with `<RouterProvider>`
948- Load data with a Route `loader` and mutate with a Route `action`
949- Handle errors with Route `errorElement`
950- Submit data with the new `<Form>` component
951- Perform in-page data loads and mutations with `useFetcher()`
952- Defer non-critical data with `defer` and `Await`
953- Manage scroll position with `<ScrollRestoration>`
954
955**New Features**
956
957- Perform path-relative navigations with `<Link relative="path">` (#9160)
958
959**Bug Fixes**
960
961- Path resolution is now trailing slash agnostic (#8861)
962- `useLocation` returns the scoped location inside a `<Routes location>` component (#9094)
963- respect the `<Link replace>` prop if it is defined (#8779)
964
965**Updated Dependencies**
966
967- `react-router@6.4.0`
Note: See TracBrowser for help on using the repository browser.