react-router 8.3.1 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/dist/development/dom-export.js +1 -1
- package/dist/development/index-react-server-client.js +1 -1
- package/dist/development/index-react-server.d.ts +42 -48
- package/dist/development/index-react-server.js +75 -31
- package/dist/development/index.d.ts +2 -2
- package/dist/development/index.js +3 -3
- package/dist/development/lib/actions.js +1 -1
- package/dist/development/lib/components.js +45 -8
- package/dist/development/lib/context.d.ts +13 -5
- package/dist/development/lib/context.js +11 -3
- package/dist/development/lib/dom/dom.js +1 -1
- package/dist/development/lib/dom/lib.js +14 -32
- package/dist/development/lib/dom/server.d.ts +6 -1
- package/dist/development/lib/dom/server.js +40 -14
- package/dist/development/lib/dom/ssr/components.js +15 -23
- package/dist/development/lib/dom/ssr/data.js +1 -1
- package/dist/development/lib/dom/ssr/entry.d.ts +4 -0
- package/dist/development/lib/dom/ssr/errorBoundaries.js +1 -1
- package/dist/development/lib/dom/ssr/fallback.js +1 -1
- package/dist/development/lib/dom/ssr/fog-of-war.js +33 -12
- package/dist/development/lib/dom/ssr/hydration.d.ts +3 -1
- package/dist/development/lib/dom/ssr/hydration.js +6 -4
- package/dist/development/lib/dom/ssr/invariant.js +1 -1
- package/dist/development/lib/dom/ssr/links.js +1 -1
- package/dist/development/lib/dom/ssr/markup.js +5 -2
- package/dist/development/lib/dom/ssr/routeModules.js +1 -1
- package/dist/development/lib/dom/ssr/routes-test-stub.js +1 -1
- package/dist/development/lib/dom/ssr/routes.js +1 -1
- package/dist/development/lib/dom/ssr/server.js +2 -2
- package/dist/development/lib/dom/ssr/single-fetch.js +10 -19
- package/dist/development/lib/dom-export/dom-router-provider.js +1 -1
- package/dist/development/lib/dom-export/hydrated-router.js +2 -1
- package/dist/development/lib/errors.js +1 -1
- package/dist/development/lib/hooks.js +49 -44
- package/dist/development/lib/href.js +1 -1
- package/dist/development/lib/router/history.js +1 -1
- package/dist/development/lib/router/instrumentation.js +1 -1
- package/dist/development/lib/router/matcher-route-pattern.d.ts +2 -0
- package/dist/development/lib/router/matcher-route-pattern.js +216 -0
- package/dist/development/lib/router/matcher-route-pattern.preload.d.ts +20 -0
- package/dist/development/lib/router/matcher-route-pattern.preload.js +36 -0
- package/dist/development/lib/router/matcher.d.ts +2 -0
- package/dist/development/lib/router/matcher.js +29 -0
- package/dist/development/lib/router/navigation.js +1 -1
- package/dist/development/lib/router/router.d.ts +13 -7
- package/dist/development/lib/router/router.js +81 -66
- package/dist/development/lib/router/url.js +1 -1
- package/dist/development/lib/router/utils.d.ts +6 -1
- package/dist/development/lib/router/utils.js +6 -4
- package/dist/development/lib/rsc/browser.js +2 -1
- package/dist/development/lib/rsc/errorBoundaries.js +1 -1
- package/dist/development/lib/rsc/html-stream/browser.js +1 -1
- package/dist/development/lib/rsc/html-stream/server.js +2 -4
- package/dist/development/lib/rsc/route-modules.js +1 -1
- package/dist/development/lib/rsc/server.rsc.d.ts +7 -0
- package/dist/development/lib/rsc/server.ssr.js +25 -21
- package/dist/development/lib/server-runtime/cookies.js +1 -1
- package/dist/development/lib/server-runtime/crypto.js +1 -1
- package/dist/development/lib/server-runtime/data.js +1 -1
- package/dist/development/lib/server-runtime/dev.js +1 -1
- package/dist/development/lib/server-runtime/entry.js +1 -1
- package/dist/development/lib/server-runtime/errors.js +1 -1
- package/dist/development/lib/server-runtime/headers.js +1 -1
- package/dist/development/lib/server-runtime/invariant.js +1 -1
- package/dist/development/lib/server-runtime/mode.js +1 -1
- package/dist/development/lib/server-runtime/routeMatching.js +3 -4
- package/dist/development/lib/server-runtime/routes.js +1 -1
- package/dist/development/lib/server-runtime/server.js +7 -6
- package/dist/development/lib/server-runtime/serverHandoff.js +1 -1
- package/dist/development/lib/server-runtime/sessions/cookieStorage.js +1 -1
- package/dist/development/lib/server-runtime/sessions/memoryStorage.js +1 -1
- package/dist/development/lib/server-runtime/sessions.js +1 -1
- package/dist/development/lib/server-runtime/single-fetch.js +1 -1
- package/dist/development/lib/server-runtime/urls.js +1 -1
- package/dist/development/lib/server-runtime/warnings.js +1 -1
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/route-pattern.d.ts +3 -0
- package/dist/development/route-pattern.js +12 -0
- package/dist/development/vendor/turbo-stream-v2/flatten.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/turbo-stream.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/unflatten.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/utils.js +1 -1
- package/dist/production/dom-export.js +1 -1
- package/dist/production/index-react-server-client.js +1 -1
- package/dist/production/index-react-server.d.ts +42 -48
- package/dist/production/index-react-server.js +75 -31
- package/dist/production/index.d.ts +2 -2
- package/dist/production/index.js +3 -3
- package/dist/production/lib/actions.js +1 -1
- package/dist/production/lib/components.js +45 -8
- package/dist/production/lib/context.d.ts +13 -5
- package/dist/production/lib/context.js +11 -3
- package/dist/production/lib/dom/dom.js +1 -1
- package/dist/production/lib/dom/lib.js +14 -32
- package/dist/production/lib/dom/server.d.ts +6 -1
- package/dist/production/lib/dom/server.js +40 -14
- package/dist/production/lib/dom/ssr/components.js +15 -23
- package/dist/production/lib/dom/ssr/data.js +1 -1
- package/dist/production/lib/dom/ssr/entry.d.ts +4 -0
- package/dist/production/lib/dom/ssr/errorBoundaries.js +1 -1
- package/dist/production/lib/dom/ssr/fallback.js +1 -1
- package/dist/production/lib/dom/ssr/fog-of-war.js +33 -12
- package/dist/production/lib/dom/ssr/hydration.d.ts +3 -1
- package/dist/production/lib/dom/ssr/hydration.js +6 -4
- package/dist/production/lib/dom/ssr/invariant.js +1 -1
- package/dist/production/lib/dom/ssr/links.js +1 -1
- package/dist/production/lib/dom/ssr/markup.js +5 -2
- package/dist/production/lib/dom/ssr/routeModules.js +1 -1
- package/dist/production/lib/dom/ssr/routes-test-stub.js +1 -1
- package/dist/production/lib/dom/ssr/routes.js +1 -1
- package/dist/production/lib/dom/ssr/server.js +2 -2
- package/dist/production/lib/dom/ssr/single-fetch.js +10 -19
- package/dist/production/lib/dom-export/dom-router-provider.js +1 -1
- package/dist/production/lib/dom-export/hydrated-router.js +2 -1
- package/dist/production/lib/errors.js +1 -1
- package/dist/production/lib/hooks.js +49 -44
- package/dist/production/lib/href.js +1 -1
- package/dist/production/lib/router/history.js +1 -1
- package/dist/production/lib/router/instrumentation.js +1 -1
- package/dist/production/lib/router/matcher-route-pattern.d.ts +2 -0
- package/dist/production/lib/router/matcher-route-pattern.js +216 -0
- package/dist/production/lib/router/matcher-route-pattern.preload.d.ts +20 -0
- package/dist/production/lib/router/matcher-route-pattern.preload.js +36 -0
- package/dist/production/lib/router/matcher.d.ts +2 -0
- package/dist/production/lib/router/matcher.js +29 -0
- package/dist/production/lib/router/navigation.js +1 -1
- package/dist/production/lib/router/router.d.ts +13 -7
- package/dist/production/lib/router/router.js +81 -66
- package/dist/production/lib/router/url.js +1 -1
- package/dist/production/lib/router/utils.d.ts +6 -1
- package/dist/production/lib/router/utils.js +6 -4
- package/dist/production/lib/rsc/browser.js +2 -1
- package/dist/production/lib/rsc/errorBoundaries.js +1 -1
- package/dist/production/lib/rsc/html-stream/browser.js +1 -1
- package/dist/production/lib/rsc/html-stream/server.js +2 -4
- package/dist/production/lib/rsc/route-modules.js +1 -1
- package/dist/production/lib/rsc/server.rsc.d.ts +7 -0
- package/dist/production/lib/rsc/server.ssr.js +25 -21
- package/dist/production/lib/server-runtime/cookies.js +1 -1
- package/dist/production/lib/server-runtime/crypto.js +1 -1
- package/dist/production/lib/server-runtime/data.js +1 -1
- package/dist/production/lib/server-runtime/dev.js +1 -1
- package/dist/production/lib/server-runtime/entry.js +1 -1
- package/dist/production/lib/server-runtime/errors.js +1 -1
- package/dist/production/lib/server-runtime/headers.js +1 -1
- package/dist/production/lib/server-runtime/invariant.js +1 -1
- package/dist/production/lib/server-runtime/mode.js +1 -1
- package/dist/production/lib/server-runtime/routeMatching.js +3 -4
- package/dist/production/lib/server-runtime/routes.js +1 -1
- package/dist/production/lib/server-runtime/server.js +7 -6
- package/dist/production/lib/server-runtime/serverHandoff.js +1 -1
- package/dist/production/lib/server-runtime/sessions/cookieStorage.js +1 -1
- package/dist/production/lib/server-runtime/sessions/memoryStorage.js +1 -1
- package/dist/production/lib/server-runtime/sessions.js +1 -1
- package/dist/production/lib/server-runtime/single-fetch.js +1 -1
- package/dist/production/lib/server-runtime/urls.js +1 -1
- package/dist/production/lib/server-runtime/warnings.js +1 -1
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/route-pattern.d.ts +3 -0
- package/dist/production/route-pattern.js +12 -0
- package/dist/production/vendor/turbo-stream-v2/flatten.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/turbo-stream.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/unflatten.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/utils.js +1 -1
- package/docs/how-to/fetchers.md +6 -1
- package/docs/how-to/middleware.md +3 -1
- package/docs/how-to/optimize-revalidation.md +178 -5
- package/docs/how-to/react-server-components.md +26 -3
- package/docs/how-to/resource-routes.md +3 -0
- package/docs/start/data/actions.md +2 -1
- package/docs/start/data/route-object.md +21 -6
- package/docs/start/framework/actions.md +4 -2
- package/docs/start/framework/route-module.md +32 -5
- package/docs/upgrading/future.md +68 -0
- package/package.json +11 -1
|
@@ -9,7 +9,7 @@ order: 5
|
|
|
9
9
|
|
|
10
10
|
## Defining Actions
|
|
11
11
|
|
|
12
|
-
Data mutations are done through Route actions defined on the `action` property of a route object. When the action completes, all loader data on the page is revalidated to keep your UI in sync with the data without writing any code to do it.
|
|
12
|
+
Data mutations are done through Route actions defined on the `action` property of a route object. When the action completes, all loader data on the page is revalidated to keep your UI in sync with the data without writing any code to do it. To skip some or all of those reloads, see [Revalidation Optimization][optimize-revalidation].
|
|
13
13
|
|
|
14
14
|
```tsx
|
|
15
15
|
import { createBrowserRouter } from "react-router";
|
|
@@ -136,3 +136,4 @@ function Project() {
|
|
|
136
136
|
Next: [Navigating](./navigating)
|
|
137
137
|
|
|
138
138
|
[fetchers]: ../../how-to/fetchers
|
|
139
|
+
[optimize-revalidation]: ../../how-to/optimize-revalidation
|
|
@@ -188,7 +188,7 @@ export default function Items() {
|
|
|
188
188
|
|
|
189
189
|
Loader data is automatically revalidated after certain events like navigations and form submissions.
|
|
190
190
|
|
|
191
|
-
This
|
|
191
|
+
This function lets you opt in or out of the default revalidation behavior **for this route's loader**. It does not skip parent or sibling loaders. The default behavior is nuanced to avoid calling loaders unnecessarily.
|
|
192
192
|
|
|
193
193
|
A route loader is revalidated when:
|
|
194
194
|
|
|
@@ -201,21 +201,34 @@ By defining this function, you opt out of the default behavior completely and ca
|
|
|
201
201
|
```tsx
|
|
202
202
|
import type { ShouldRevalidateFunctionArgs } from "react-router";
|
|
203
203
|
|
|
204
|
-
function shouldRevalidate(
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
204
|
+
function shouldRevalidate({
|
|
205
|
+
formMethod,
|
|
206
|
+
formAction,
|
|
207
|
+
defaultShouldRevalidate,
|
|
208
|
+
}: ShouldRevalidateFunctionArgs) {
|
|
209
|
+
if (
|
|
210
|
+
formMethod === "POST" &&
|
|
211
|
+
formAction?.endsWith("/analytics")
|
|
212
|
+
) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return defaultShouldRevalidate;
|
|
208
217
|
}
|
|
209
218
|
|
|
210
219
|
createBrowserRouter([
|
|
211
220
|
{
|
|
212
221
|
path: "/",
|
|
213
|
-
shouldRevalidate
|
|
222
|
+
shouldRevalidate,
|
|
214
223
|
Component: MyRoute,
|
|
215
224
|
},
|
|
216
225
|
]);
|
|
217
226
|
```
|
|
218
227
|
|
|
228
|
+
To skip revalidation for a single `<Form>`, `<Link>`, `useSubmit`, or `fetcher.submit`, pass [`defaultShouldRevalidate={false}`][form-default-should-revalidate] at the call site. Routes without `shouldRevalidate` use that value directly.
|
|
229
|
+
|
|
230
|
+
See [Revalidation Optimization][optimize-revalidation] for call-site opt-out, parent/child behavior, and more examples.
|
|
231
|
+
|
|
219
232
|
[`ShouldRevalidateFunctionArgs` Reference Documentation ↗](https://api.reactrouter.com/v8/interfaces/react-router.ShouldRevalidateFunctionArgs.html)
|
|
220
233
|
|
|
221
234
|
Please note the default behavior is different in [Framework Mode](../modes).
|
|
@@ -263,6 +276,8 @@ See also:
|
|
|
263
276
|
|
|
264
277
|
Next: [Data Loading](./data-loading)
|
|
265
278
|
|
|
279
|
+
[form-default-should-revalidate]: ../../api/components/Form#defaultshouldrevalidate
|
|
266
280
|
[loader-params]: https://api.reactrouter.com/v8/interfaces/react-router.LoaderFunctionArgs
|
|
267
281
|
[middleware]: ../../how-to/middleware
|
|
282
|
+
[optimize-revalidation]: ../../how-to/optimize-revalidation
|
|
268
283
|
[use-matches]: ../../api/hooks/useMatches
|
|
@@ -9,7 +9,7 @@ order: 6
|
|
|
9
9
|
|
|
10
10
|
## Introduction
|
|
11
11
|
|
|
12
|
-
Data mutations are done through Route actions. When the action completes, all loader data on the page is revalidated to keep your UI in sync with the data without writing any code to do it.
|
|
12
|
+
Data mutations are done through Route actions. When the action completes, all loader data on the page is revalidated to keep your UI in sync with the data without writing any code to do it. To skip some or all of those reloads, see [Revalidation Optimization][optimize-revalidation].
|
|
13
13
|
|
|
14
14
|
Route actions defined with `action` are only called on the server while actions defined with `clientAction` are run in the browser.
|
|
15
15
|
|
|
@@ -165,10 +165,12 @@ fetcher.submit(
|
|
|
165
165
|
);
|
|
166
166
|
```
|
|
167
167
|
|
|
168
|
-
See the [Using Fetchers][fetchers] guide for more information.
|
|
168
|
+
`fetcher.submit` takes [`FetcherSubmitOptions`][fetcher-submit-options], including `defaultShouldRevalidate`. See the [Using Fetchers][fetchers] guide for more information.
|
|
169
169
|
|
|
170
170
|
---
|
|
171
171
|
|
|
172
172
|
Next: [Navigating](./navigating)
|
|
173
173
|
|
|
174
174
|
[fetchers]: ../../how-to/fetchers
|
|
175
|
+
[fetcher-submit-options]: https://api.reactrouter.com/v8/interfaces/react-router.FetcherSubmitOptions.html#defaultshouldrevalidate
|
|
176
|
+
[optimize-revalidation]: ../../how-to/optimize-revalidation
|
|
@@ -486,18 +486,43 @@ The meta of the last matching route is used, allowing you to override parent rou
|
|
|
486
486
|
|
|
487
487
|
In framework mode with SSR, route loaders are automatically revalidated after all navigations and form submissions (this is different from [Data Mode][data-mode-should-revalidate]). This enables middleware and loaders to share a request context and optimize in different ways than they would in Data Mode.
|
|
488
488
|
|
|
489
|
-
Defining this function allows you to opt out of revalidation for
|
|
489
|
+
Defining this function allows you to opt out of revalidation for **this route's** loader. It does not skip parent or sibling loaders. After `fetcher.submit()`, `root` still revalidates unless it also opts out.
|
|
490
|
+
|
|
491
|
+
Returning `false` for every call turns revalidation off for this loader:
|
|
492
|
+
|
|
493
|
+
```tsx
|
|
494
|
+
export function shouldRevalidate() {
|
|
495
|
+
return false;
|
|
496
|
+
}
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
<docs-warning>
|
|
500
|
+
Always returning `false` can leave this route's UI out of sync with the server. Prefer inspecting the arguments and falling back to `defaultShouldRevalidate`.
|
|
501
|
+
</docs-warning>
|
|
490
502
|
|
|
491
503
|
```tsx
|
|
492
504
|
import type { ShouldRevalidateFunctionArgs } from "react-router";
|
|
493
505
|
|
|
494
|
-
export function shouldRevalidate(
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
506
|
+
export function shouldRevalidate({
|
|
507
|
+
formMethod,
|
|
508
|
+
formAction,
|
|
509
|
+
defaultShouldRevalidate,
|
|
510
|
+
}: ShouldRevalidateFunctionArgs) {
|
|
511
|
+
if (
|
|
512
|
+
formMethod === "POST" &&
|
|
513
|
+
formAction?.endsWith("/analytics")
|
|
514
|
+
) {
|
|
515
|
+
return false;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
return defaultShouldRevalidate;
|
|
498
519
|
}
|
|
499
520
|
```
|
|
500
521
|
|
|
522
|
+
To skip revalidation for a single `<Form>`, `<Link>`, `useSubmit`, or `fetcher.submit` without changing every route file, pass [`defaultShouldRevalidate={false}`][form-default-should-revalidate] at the call site. Routes without a `shouldRevalidate` export use that value directly; routes that export one receive it as `defaultShouldRevalidate` and still decide.
|
|
523
|
+
|
|
524
|
+
See [Revalidation Optimization][optimize-revalidation] for Framework vs Data Mode defaults, parent/child behavior, and more examples.
|
|
525
|
+
|
|
501
526
|
When using [SPA Mode][spa-mode], there are no server loaders to call on navigations, so `shouldRevalidate` behaves the same as it does in [Data Mode][data-mode-should-revalidate].
|
|
502
527
|
|
|
503
528
|
[`ShouldRevalidateFunctionArgs` Reference Documentation ↗](https://api.reactrouter.com/v8/interfaces/react-router.ShouldRevalidateFunctionArgs.html)
|
|
@@ -522,6 +547,8 @@ Next: [Rendering Strategies](./rendering)
|
|
|
522
547
|
[meta-params]: https://api.reactrouter.com/v8/interfaces/react-router.MetaArgs
|
|
523
548
|
[meta-function]: https://api.reactrouter.com/v8/types/react-router.MetaDescriptor.html
|
|
524
549
|
[data-mode-should-revalidate]: ../data/route-object#shouldrevalidate
|
|
550
|
+
[form-default-should-revalidate]: ../../api/components/Form#defaultshouldrevalidate
|
|
551
|
+
[optimize-revalidation]: ../../how-to/optimize-revalidation
|
|
525
552
|
[spa-mode]: ../../how-to/spa
|
|
526
553
|
[client-data]: ../../how-to/client-data
|
|
527
554
|
[styling]: ../../explanation/styling
|
package/docs/upgrading/future.md
CHANGED
|
@@ -106,6 +106,74 @@ export default {
|
|
|
106
106
|
|
|
107
107
|
No code changes are required. If you run into dependency optimization issues after enabling this flag, remove the flag and restart the dev server.
|
|
108
108
|
|
|
109
|
+
### `future.unstable_routePatternMatching`
|
|
110
|
+
|
|
111
|
+
[MODES: data]
|
|
112
|
+
|
|
113
|
+
<br/>
|
|
114
|
+
<br/>
|
|
115
|
+
|
|
116
|
+
**Background**
|
|
117
|
+
|
|
118
|
+
This flag opts Data Routers into a new (and vastly more efficient) route matcher
|
|
119
|
+
powered by [`@remix-run/route-pattern`](https://github.com/remix-run/remix/tree/main/packages/route-pattern).
|
|
120
|
+
It supports the existing React Router path syntax and matching behavior, but may
|
|
121
|
+
rank _slightly_ differently in some cases - please read the section below on
|
|
122
|
+
potential ranking differences.
|
|
123
|
+
|
|
124
|
+
👉 **Preload the Matcher and Enable the Flag**
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
import { createBrowserRouter } from "react-router";
|
|
128
|
+
import { unstable_preloadRoutePattern } from "react-router/route-pattern";
|
|
129
|
+
|
|
130
|
+
unstable_preloadRoutePattern();
|
|
131
|
+
|
|
132
|
+
const router = createBrowserRouter(routes, {
|
|
133
|
+
future: {
|
|
134
|
+
unstable_routePatternMatching: true,
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The `react-router/route-pattern` sub-export statically imports the new matcher
|
|
140
|
+
implementation. Tree-shaking bundlers remove it from applications that do not
|
|
141
|
+
use the preload function. You must call the function before creating a router
|
|
142
|
+
with the flag enabled - router creation will throw if the matcher has not been
|
|
143
|
+
initialized. Initialization is synchronous, and repeated calls are safe.
|
|
144
|
+
|
|
145
|
+
**Update your Code**
|
|
146
|
+
|
|
147
|
+
No route configuration changes are required, but you should review any routes with
|
|
148
|
+
overlapping patterns to ensure the new ranking behavior selects the intended route.
|
|
149
|
+
The new implementation matches by positional specificity instead of aggregate
|
|
150
|
+
segment scores. This means a route with a longer static prefix can rank above a
|
|
151
|
+
route with more dynamic segments.
|
|
152
|
+
|
|
153
|
+
For example, both of these routes match `/products/one/two/three`:
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
const routes = [
|
|
157
|
+
{ path: "/products/*", id: "products" },
|
|
158
|
+
{
|
|
159
|
+
path: "/:first/:second/:third/:fourth",
|
|
160
|
+
id: "segments",
|
|
161
|
+
},
|
|
162
|
+
];
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The legacy matcher selects `segments` based on its aggregate segment score. The
|
|
166
|
+
new matcher selects `products` because its static `products` segment is more
|
|
167
|
+
specific than the dynamic `:first` segment in the same position.
|
|
168
|
+
|
|
169
|
+
Once you enable this flag, use the `router.match()` when you need to match a
|
|
170
|
+
location (this is currently marked private and will become stable at the same
|
|
171
|
+
time this flag stabilizes). Standalone matching APIs such as `matchRoutes`,
|
|
172
|
+
`matchPath`, and `useMatch` continue to use the legacy matcher and may return
|
|
173
|
+
different matches than the router.
|
|
174
|
+
|
|
175
|
+
Case-sensitive routes are not currently supported with this flag.
|
|
176
|
+
|
|
109
177
|
[api-development-strategy]: ../community/api-development-strategy
|
|
110
178
|
[governance]: https://github.com/remix-run/react-router/blob/main/GOVERNANCE.md#design-goals
|
|
111
179
|
[unstable]: ../community/api-development-strategy#unstable-flags
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-router",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.4.0",
|
|
5
5
|
"description": "Declarative routing for React",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"react",
|
|
@@ -46,6 +46,15 @@
|
|
|
46
46
|
"development": "./dist/development/dom-export.js",
|
|
47
47
|
"default": "./dist/production/dom-export.js"
|
|
48
48
|
},
|
|
49
|
+
"./route-pattern": {
|
|
50
|
+
"types": "./dist/production/route-pattern.d.ts",
|
|
51
|
+
"module-sync": {
|
|
52
|
+
"development": "./dist/development/route-pattern.js",
|
|
53
|
+
"default": "./dist/production/route-pattern.js"
|
|
54
|
+
},
|
|
55
|
+
"development": "./dist/development/route-pattern.js",
|
|
56
|
+
"default": "./dist/production/route-pattern.js"
|
|
57
|
+
},
|
|
49
58
|
"./internal": {
|
|
50
59
|
"types": "./dist/development/lib/types/internal.d.ts"
|
|
51
60
|
},
|
|
@@ -76,6 +85,7 @@
|
|
|
76
85
|
}
|
|
77
86
|
},
|
|
78
87
|
"dependencies": {
|
|
88
|
+
"@remix-run/route-pattern": "^0.22.1",
|
|
79
89
|
"cookie-es": "^3.1.1"
|
|
80
90
|
},
|
|
81
91
|
"devDependencies": {
|