You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+13-9Lines changed: 13 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -491,7 +491,7 @@ Date: 2023-10-16
491
491
492
492
#### View Transitions 🚀
493
493
494
-
We're excited to release experimental support for the the [View Transitions API](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition) in React Router! You can now trigger navigational DOM updates to be wrapped in `document.startViewTransition` to enable CSS animated transitions on SPA navigations in your application.
494
+
We're excited to release experimental support for the [View Transitions API](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition) in React Router! You can now trigger navigational DOM updates to be wrapped in `document.startViewTransition` to enable CSS animated transitions on SPA navigations in your application.
495
495
496
496
The simplest approach to enabling a View Transition in your React Router app is via the new [`<Link unstable_viewTransition>`](https://reactrouter.com/components/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.
497
497
@@ -711,6 +711,8 @@ Date: 2023-06-14
711
711
712
712
`6.13.0` is really a patch release in spirit but comes with a SemVer minor bump since we added a new future flag.
713
713
714
+
#### v7_startTransition
715
+
714
716
The **tl;dr;** is that `6.13.0` is the same as [`6.12.0`](https://github.com/remix-run/react-router/releases/tag/react-router%406.12.0) bue we've moved the usage of `React.startTransition` behind an opt-in `future.v7_startTransition`[future flag](https://reactrouter.com/en/main/guides/api-development-strategy) because we found that there are applications in the wild that are currently using `Suspense` in ways that are incompatible with `React.startTransition`.
715
717
716
718
Therefore, in `6.13.0` the default behavior will no longer leverage `React.startTransition`:
@@ -862,14 +864,16 @@ You can also check out the docs [here](https://reactrouter.com/en/dev/guides/api
862
864
863
865
### Minor Changes
864
866
865
-
- The first future 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()` (and some Remix) behavior. ([#10207](https://github.com/remix-run/react-router/pull/10207))
867
+
#### future.v7_normalizeFormMethod
868
+
869
+
The first future 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()` (and some Remix) behavior. ([#10207](https://github.com/remix-run/react-router/pull/10207))
866
870
867
-
- When `future.v7_normalizeFormMethod` is unspecified or set to `false` (default v6 behavior),
868
-
-`useNavigation().formMethod` is lowercase
869
-
-`useFetcher().formMethod` is lowercase
870
-
- When `future.v7_normalizeFormMethod === true`:
871
-
-`useNavigation().formMethod` is UPPERCASE
872
-
-`useFetcher().formMethod` is UPPERCASE
871
+
- When `future.v7_normalizeFormMethod` is unspecified or set to `false` (default v6 behavior),
872
+
-`useNavigation().formMethod` is lowercase
873
+
-`useFetcher().formMethod` is lowercase
874
+
- When `future.v7_normalizeFormMethod === true`:
875
+
-`useNavigation().formMethod` is UPPERCASE
876
+
-`useFetcher().formMethod` is UPPERCASE
873
877
874
878
### Patch Changes
875
879
@@ -1046,7 +1050,7 @@ Support absolute URLs in `<Link to>`. If the URL is for the current origin, it w
1046
1050
1047
1051
- Fixes 2 separate issues for revalidating fetcher `shouldRevalidate` calls ([#9948](https://github.com/remix-run/react-router/pull/9948))
1048
1052
- The `shouldRevalidate` function was only being called for _explicit_ revalidation scenarios (after a mutation, manual `useRevalidator` call, or an `X-Remix-Revalidate` header used for cookie setting in Remix). It was not properly being called on _implicit_ revalidation scenarios that also apply to navigation `loader` revalidation, such as a change in search params or clicking a link for the page we're already on. It's now correctly called in those additional scenarios.
1049
-
- The parameters being passed were incorrect and inconsistent with one another since the `current*`/`next*` parameters reflected the static `fetcher.load` URL (and thus were identical). Instead, they should have reflected the the navigation that triggered the revalidation (as the `form*` parameters did). These parameters now correctly reflect the triggering navigation.
1053
+
- The parameters being passed were incorrect and inconsistent with one another since the `current*`/`next*` parameters reflected the static `fetcher.load` URL (and thus were identical). Instead, they should have reflected the navigation that triggered the revalidation (as the `form*` parameters did). These parameters now correctly reflect the triggering navigation.
1050
1054
- Fix bug with search params removal via `useSearchParams` ([#9969](https://github.com/remix-run/react-router/pull/9969))
1051
1055
- Respect `preventScrollReset` on `<fetcher.Form>` ([#9963](https://github.com/remix-run/react-router/pull/9963))
1052
1056
- Fix navigation for hash routers on manual URL changes ([#9980](https://github.com/remix-run/react-router/pull/9980))
Copy file name to clipboardExpand all lines: docs/components/form.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,7 +92,7 @@ function ProjectsPage() {
92
92
</DataBrowserRouter>;
93
93
```
94
94
95
-
If the the current URL is `"/projects/123"`, the form inside the child
95
+
If the current URL is `"/projects/123"`, the form inside the child
96
96
route, `ProjectsPage`, will have a default action as you might expect: `"/projects/123"`. In this case, where the route is the deepest matching route, both `<Form>` and plain HTML forms have the same result.
97
97
98
98
But the form inside of `ProjectsLayout` will point to `"/projects"`, not the full URL. In other words, it points to the matching segment of the URL for the route in which the form is rendered.
Copy file name to clipboardExpand all lines: docs/guides/api-development-strategy.md
+16-91Lines changed: 16 additions & 91 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,115 +5,40 @@ new: true
5
5
6
6
# API Development Strategy
7
7
8
-
Let's cut to the chase - major version upgrades can be a _pain_. Especially for something as foundational to your application as the framework or router it's built on. For Remix and React Router, we want to do our best to give you the smoothest upgrade experience possible.
8
+
React Router is foundational to your application. We want to make sure that upgrading to new major versions is as smooth as possible while still allowing us to adjust and enhance the behavior and API as the React ecosystem advances.
9
9
10
-
<docs-info>This strategy is discussed in more detail in our [Future Flags][future-flags-blog-post] blog post, so give that a read if you want any more info at the end of this doc!</docs-info>
10
+
Our strategy and motivations are discussed in more detail in our [Future Flags][future-flags-blog-post] blog post.
11
11
12
-
## Goals
12
+
## Future Flags
13
13
14
-
Our goals for major Remix and React Router releases are:
14
+
When an API changes in a breaking way, it is introduced in a future flag. This allows you to opt-in to one change a time before it becomes the default in the next major version.
15
15
16
-
-Developers can opt-into SemVer-major features individually _as they are released_ instead of having to wait to adopt them all at once when a new major version hits NPM
17
-
-Having opted into features ahead-of-time, developers can upgrade to new major versions in a single short-lived branch/commit (hours, not weeks)
16
+
-Without enabling the future flag, nothing changes about your app
17
+
-Enabling the flag changes the behavior for that feature
18
18
19
-
## Implementation
19
+
All current future flags are documented in the [Future Flags Guide](../upgrading/future) to help you stay up-to-date.
20
20
21
-
We plan to do this via what we're calling **Future Flags** that you'll provide when you initialize your [Data Router][picking-a-router]. Think of these as **feature flags for future features**. As we implement new features, we always try to do them in a backwards-compatible way. But when a breaking change is warranted, we don't table that feature up for an _eventual_ v7 release. Instead, we add a **Future Flag** and implement the new feature alongside the current behavior in a v6 minor release. This allows users to start using the feature, providing feedback, and reporting bugs _immediately_.
21
+
## Unstable Flags
22
22
23
-
That way, not only can you adopt features incrementally (and eagerly without a major version bump), we can also work out any kinks incrementally _before_ releasing v7. Eventually we also then add deprecation warnings to the v6 releases to nudge users to the new behavior. Then in v7 we remove the old v6 approach, remove the deprecations, and remove the flag - thus making the flagged behavior the new default in v7. If at the time v6 is released, an application has opted into _all_ future flags and updated their code - then they should just be able to update their dependency to v7, delete the future flags, and be running on v7 in a matter of minutes.
23
+
Unstable flags are for features still being designed and developed and made available to our users to help us get it right.
24
24
25
-
## Unstable vs. V7 Flags
25
+
Unstable flags are not recommended for production:
26
26
27
-
Future flags come in 2 forms:
27
+
- they will change without warning and without upgrade paths
28
+
- they will have bugs
29
+
- they aren't documented
30
+
- they may be scrapped completely
28
31
29
-
**`future.unstable_feature`**
32
+
When you opt-in to an unstable flag you are becoming a contributor to the project, rather than a user. We appreciate your help, but please be aware of the new role!
30
33
31
-
`unstable_` flags allow us to iterate on the API with early adopters as if we're in `v0.x.x` versions, but for a specific feature. This avoids churning the API for all users and arriving at better APIs in the final release. This _does not mean_ that we think the feature is bug-ridden! We _absolutely_ want early adopters to start using these features so we can iterate on (and/or gain confidence in) the API.
32
-
33
-
**`future.v7_feature`**
34
-
35
-
`v7_` indicates a breaking change from v6 behavior and implies (1) that the API is considered stable and will not under any more breaking changes and (2) that the API will become the default behavior in v7. A `v7_` flag _does not_ mean the feature is bug-free - no software is! Our recommendation is to upgrade to v7 flags as you have the time, as it will make your v7 upgrade _much_ smoother.
34
+
To learn about current unstable flags, keep an eye on the [CHANGELOG](../start/changelog).
36
35
37
36
### Example New Feature Flow
38
37
39
38
The decision flow for a new feature looks something like this (note this diagram is in relation to Remix v1/v2 but applies to React Router v6/v7 as well):
40
39
41
40
![Flowchart of the decision process for how to introduce a new feature][feature-flowchart]
42
41
43
-
The lifecycle is thus either:
44
-
45
-
- Non-Breaking + Stable API Feature -> Lands in v6
46
-
- Non-Breaking + Unstable API -> `future.unstable_` flag -> Lands in v6
47
-
- Breaking + Stable API Feature -> `future.v7_` flag -> Lands in v7
48
-
- Breaking + Unstable API -> `future.unstable_` flag -> `future.v7_` flag -> Lands in v7
49
-
50
-
## Current Future Flags
51
-
52
-
Here's the current future flags in React Router v6 today.
53
-
54
-
### `@remix-run/router` Future Flags
55
-
56
-
These flags are only applicable when using a [Data Router][picking-a-router] and are passed when creating the `router` instance:
Copy file name to clipboardExpand all lines: docs/hooks/use-navigate.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,7 +93,7 @@ function EditContact() {
93
93
}
94
94
```
95
95
96
-
Please note that `relative: "path"` only impacts the resolution of a relative path. It does not change the the "starting" location for that relative path resolution. This resolution is always relative to the current location in the Route hierarchy (i.e., the route `useNavigate` is called in).
96
+
Please note that `relative: "path"` only impacts the resolution of a relative path. It does not change the "starting" location for that relative path resolution. This resolution is always relative to the current location in the Route hierarchy (i.e., the route `useNavigate` is called in).
97
97
98
98
If you wish to use path-relative routing against the current URL instead of the route hierarchy, you can do that with the current [`location`][use-location] and the `URL` constructor (note the trailing slash behavior):
0 commit comments