react-router 8.3.0 → 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 +46 -2
- 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 +50 -48
- package/dist/development/index-react-server.js +96 -43
- package/dist/development/index.d.ts +2 -2
- package/dist/development/index.js +3 -3
- package/dist/development/lib/actions.js +10 -5
- package/dist/development/lib/components.js +50 -10
- package/dist/development/lib/context.d.ts +14 -5
- package/dist/development/lib/context.js +11 -3
- package/dist/development/lib/dom/dom.js +2 -2
- package/dist/development/lib/dom/lib.js +33 -36
- 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 +16 -24
- 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 +34 -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 +13 -22
- 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 +54 -46
- package/dist/development/lib/href.js +1 -1
- package/dist/development/lib/router/history.js +2 -2
- 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 +45 -0
- package/dist/development/lib/router/router.d.ts +21 -7
- package/dist/development/lib/router/router.js +111 -82
- 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 +15 -9
- package/dist/development/lib/rsc/browser.js +5 -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 +3 -5
- 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 +26 -22
- package/dist/development/lib/server-runtime/cookies.js +2 -2
- package/dist/development/lib/server-runtime/crypto.js +2 -2
- package/dist/development/lib/server-runtime/data.js +1 -1
- package/dist/development/lib/server-runtime/dev.js +2 -2
- 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 +8 -7
- 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 +2 -2
- 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 +4 -4
- 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 +50 -48
- package/dist/production/index-react-server.js +96 -43
- package/dist/production/index.d.ts +2 -2
- package/dist/production/index.js +3 -3
- package/dist/production/lib/actions.js +10 -5
- package/dist/production/lib/components.js +50 -10
- package/dist/production/lib/context.d.ts +14 -5
- package/dist/production/lib/context.js +11 -3
- package/dist/production/lib/dom/dom.js +2 -2
- package/dist/production/lib/dom/lib.js +33 -36
- 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 +16 -24
- 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 +34 -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 +13 -22
- 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 +54 -46
- package/dist/production/lib/href.js +1 -1
- package/dist/production/lib/router/history.js +2 -2
- 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 +45 -0
- package/dist/production/lib/router/router.d.ts +21 -7
- package/dist/production/lib/router/router.js +111 -82
- 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 +15 -9
- package/dist/production/lib/rsc/browser.js +5 -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 +3 -5
- 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 +26 -22
- package/dist/production/lib/server-runtime/cookies.js +2 -2
- package/dist/production/lib/server-runtime/crypto.js +2 -2
- package/dist/production/lib/server-runtime/data.js +1 -1
- package/dist/production/lib/server-runtime/dev.js +2 -2
- 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 +8 -7
- 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 +2 -2
- 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 +4 -4
- 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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
+
## v8.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Deprecate the `createStaticRouter({ branches })` option ([#15297](https://github.com/remix-run/react-router/pull/15297))
|
|
8
|
+
- `createStaticRouter` now caches route branches internally, ignores `branches`, and logs a deprecation warning when the option is provided
|
|
9
|
+
- The deprecated `EntryContext.branches` property remains available for compatibility but is always an empty array
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Prevent stale route discovery during manifest version-mismatch recovery ([#15489](https://github.com/remix-run/react-router/pull/15489))
|
|
14
|
+
- Keep concurrent manifest responses pending while a document reload is in progress
|
|
15
|
+
- Report a discovery error when a previous reload failed to resolve a version mismatch instead of loading a stale route or reloading repeatedly
|
|
16
|
+
- Fail pending requests if a document reload does not complete within five seconds or the document is restored from the back-forward cache, allowing subsequent requests to recover
|
|
17
|
+
- Preserve lazy route module import errors during SPA navigations instead of replacing them with a missing `dataStrategy` result error ([#15464](https://github.com/remix-run/react-router/pull/15464))
|
|
18
|
+
- Switch to more granular internal router contexts to avoid unnecessary route component re-renders when unrelated data router state changes ([#15376](https://github.com/remix-run/react-router/pull/15376))
|
|
19
|
+
- ⚠️ This contains some breaking changes to exported `UNSAFE_` contexts, so please review carefully if you are using those unsafe exports
|
|
20
|
+
- Correctly escape streamed RSC redirect locations in meta tag attributes ([#15491](https://github.com/remix-run/react-router/pull/15491))
|
|
21
|
+
- Avoid unintended `document.startViewTransition` calls during initial hydration and `router.revalidate()` calls ([#15484](https://github.com/remix-run/react-router/pull/15484))
|
|
22
|
+
- Fix `SingleFetchNoResultError` thrown when a fetcher revalidates against a splat route during lazy route discovery ([#15395](https://github.com/remix-run/react-router/pull/15395))
|
|
23
|
+
- Track discovery per fetcher load so revalidation waits for the current load's discovery, even when the fetcher key is reused, while still restarting interrupted loaders after discovery completes
|
|
24
|
+
- Preserve the underlying decode failure as the `cause` of the `Unable to decode turbo-stream response` error ([#15450](https://github.com/remix-run/react-router/pull/15450))
|
|
25
|
+
|
|
26
|
+
### Unstable Changes
|
|
27
|
+
|
|
28
|
+
⚠️ _[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use_
|
|
29
|
+
|
|
30
|
+
- Add a Data Mode `future.unstable_routePatternMatching` flag for more efficient route matching powered by `@remix-run/route-pattern` ([#15298](https://github.com/remix-run/react-router/pull/15298))
|
|
31
|
+
- Add an `unstable_validateParams` route field to reject invalid parameter values and continue matching
|
|
32
|
+
- Document access control requirements for RSC Server Functions ([#15490](https://github.com/remix-run/react-router/pull/15490))
|
|
33
|
+
- Treat every Server Function as a public endpoint that must perform all of its own access control checks
|
|
34
|
+
- Recommend route actions when access control should be provided by route middleware
|
|
35
|
+
|
|
36
|
+
## v8.3.1
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- Fix `Expected fetcher: <key>` error thrown on navigation when a fetcher is aborted during its post-action revalidation ([#15365](https://github.com/remix-run/react-router/pull/15365))
|
|
41
|
+
- Fix lazy route discovery caching a path as discovered when the triggering navigation was aborted after the manifest response settled but before the route tree was patched, which permanently (for the session) shadowed the real route behind a catch-all or produced 404s on every subsequent visit ([#15399](https://github.com/remix-run/react-router/pull/15399))
|
|
42
|
+
- Improve route matching performance for long paths ([#15417](https://github.com/remix-run/react-router/pull/15417))
|
|
43
|
+
- Improve validation of action request origins ([#15419](https://github.com/remix-run/react-router/pull/15419))
|
|
44
|
+
- Fix `<ScrollRestoration>` leaving `history.scrollRestoration` set to `"auto"` after a bfcache restore, which let the browser restore scroll on subsequent history traversals before the destination route had rendered ([#15397](https://github.com/remix-run/react-router/pull/15397))
|
|
45
|
+
- Properly respect the `relative` option in `useSubmit`/`fetcher.submit` when resolivng the `action` path ([#15400](https://github.com/remix-run/react-router/pull/15400))
|
|
46
|
+
- Add additional URL validation on client side navigations/redirects ([#15445](https://github.com/remix-run/react-router/pull/15445))
|
|
47
|
+
|
|
3
48
|
## v8.3.0
|
|
4
49
|
|
|
5
50
|
### Patch Changes
|
|
@@ -17,7 +62,7 @@
|
|
|
17
62
|
|
|
18
63
|
### Unstable Changes
|
|
19
64
|
|
|
20
|
-
⚠️
|
|
65
|
+
⚠️ _[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use_
|
|
21
66
|
|
|
22
67
|
- Detect stale RSC clients during lazy route discovery and reload the destination document ([#15318](https://github.com/remix-run/react-router/pull/15318))
|
|
23
68
|
|
|
@@ -35,7 +80,6 @@
|
|
|
35
80
|
```
|
|
36
81
|
|
|
37
82
|
- Add CSP nonce support to RSC document rendering ([#15320](https://github.com/remix-run/react-router/pull/15320))
|
|
38
|
-
|
|
39
83
|
- Add `nonce` options to `unstable_routeRSCServerRequest` and `unstable_RSCStaticRouter`
|
|
40
84
|
- Forward the nonce to the HTML renderer and apply it to injected RSC payload scripts and nonce-aware framework components
|
|
41
85
|
|
|
@@ -50,7 +50,7 @@ interface Path {
|
|
|
50
50
|
* An entry in a history stack. A location contains information about the
|
|
51
51
|
* URL path, as well as possibly some arbitrary state and a key.
|
|
52
52
|
*/
|
|
53
|
-
interface Location<State = any> extends Path {
|
|
53
|
+
interface Location$1<State = any> extends Path {
|
|
54
54
|
/**
|
|
55
55
|
* A value of arbitrary data associated with this location.
|
|
56
56
|
*/
|
|
@@ -79,7 +79,7 @@ interface Update {
|
|
|
79
79
|
/**
|
|
80
80
|
* The new location.
|
|
81
81
|
*/
|
|
82
|
-
location: Location;
|
|
82
|
+
location: Location$1;
|
|
83
83
|
/**
|
|
84
84
|
* The delta between this location and the former location in the history stack
|
|
85
85
|
*/
|
|
@@ -113,7 +113,7 @@ interface History {
|
|
|
113
113
|
/**
|
|
114
114
|
* The current location. This value is mutable.
|
|
115
115
|
*/
|
|
116
|
-
readonly location: Location;
|
|
116
|
+
readonly location: Location$1;
|
|
117
117
|
/**
|
|
118
118
|
* Returns a valid href for the given `to` value that may be used as
|
|
119
119
|
* the value of an <a href> attribute.
|
|
@@ -597,7 +597,7 @@ interface MapRoutePropertiesFunction {
|
|
|
597
597
|
* onto the route. Either they're meaningful to the router, or they'll get
|
|
598
598
|
* ignored.
|
|
599
599
|
*/
|
|
600
|
-
type UnsupportedLazyRouteObjectKey = "lazy" | "caseSensitive" | "path" | "id" | "index" | "children";
|
|
600
|
+
type UnsupportedLazyRouteObjectKey = "lazy" | "caseSensitive" | "path" | "id" | "index" | "children" | "unstable_validateParams";
|
|
601
601
|
/**
|
|
602
602
|
* Keys we cannot change from within a lazy() function. We spread all other keys
|
|
603
603
|
* onto the route. Either they're meaningful to the router, or they'll get
|
|
@@ -655,6 +655,11 @@ type BaseRouteObject = {
|
|
|
655
655
|
* See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate).
|
|
656
656
|
*/
|
|
657
657
|
shouldRevalidate?: ShouldRevalidateFunction;
|
|
658
|
+
/**
|
|
659
|
+
* A map of route param names to regular expressions used to validate params
|
|
660
|
+
* after a route-pattern match.
|
|
661
|
+
*/
|
|
662
|
+
unstable_validateParams?: Record<string, RegExp>;
|
|
658
663
|
/**
|
|
659
664
|
* The route handle.
|
|
660
665
|
*/
|
|
@@ -791,7 +796,7 @@ interface DataRouteMatch extends RouteMatch<string, DataRouteObject> {}
|
|
|
791
796
|
* Defaults to `/`.
|
|
792
797
|
* @returns An array of matched routes, or `null` if no matches were found.
|
|
793
798
|
*/
|
|
794
|
-
declare function matchRoutes<RouteObjectType extends RouteObject = RouteObject>(routes: RouteObjectType[], locationArg: Partial<Location> | string, basename?: string): RouteMatch<string, RouteObjectType>[] | null;
|
|
799
|
+
declare function matchRoutes<RouteObjectType extends RouteObject = RouteObject>(routes: RouteObjectType[], locationArg: Partial<Location$1> | string, basename?: string): RouteMatch<string, RouteObjectType>[] | null;
|
|
795
800
|
interface UIMatch<Data = unknown, Handle = unknown> {
|
|
796
801
|
id: string;
|
|
797
802
|
pathname: string;
|
|
@@ -811,30 +816,6 @@ interface UIMatch<Data = unknown, Handle = unknown> {
|
|
|
811
816
|
*/
|
|
812
817
|
handle: Handle;
|
|
813
818
|
}
|
|
814
|
-
interface RouteMeta<RouteObjectType extends RouteObject = RouteObject> {
|
|
815
|
-
relativePath: string;
|
|
816
|
-
caseSensitive: boolean;
|
|
817
|
-
childrenIndex: number;
|
|
818
|
-
route: RouteObjectType;
|
|
819
|
-
matcher?: RegExp;
|
|
820
|
-
compiledParams?: CompiledPathParam[];
|
|
821
|
-
}
|
|
822
|
-
/**
|
|
823
|
-
* @private
|
|
824
|
-
* PRIVATE - DO NOT USE
|
|
825
|
-
*
|
|
826
|
-
* A "branch" of routes that match a given route pattern.
|
|
827
|
-
* This is an internal interface not intended for direct external usage.
|
|
828
|
-
*/
|
|
829
|
-
interface RouteBranch<RouteObjectType extends RouteObject = RouteObject> {
|
|
830
|
-
path: string;
|
|
831
|
-
score: number;
|
|
832
|
-
routesMeta: RouteMeta<RouteObjectType>[];
|
|
833
|
-
}
|
|
834
|
-
type CompiledPathParam = {
|
|
835
|
-
paramName: string;
|
|
836
|
-
isOptional?: boolean;
|
|
837
|
-
};
|
|
838
819
|
declare class DataWithResponseInit<D> {
|
|
839
820
|
type: string;
|
|
840
821
|
data: D;
|
|
@@ -1143,9 +1124,10 @@ interface Router$1 {
|
|
|
1143
1124
|
* @private
|
|
1144
1125
|
* PRIVATE - DO NOT USE
|
|
1145
1126
|
*
|
|
1146
|
-
*
|
|
1127
|
+
* Match routes against a location using the router's configured route
|
|
1128
|
+
* matching implementation.
|
|
1147
1129
|
*/
|
|
1148
|
-
|
|
1130
|
+
match(locationArg: Partial<Location$1> | string): DataRouteMatch[] | null;
|
|
1149
1131
|
/**
|
|
1150
1132
|
* @private
|
|
1151
1133
|
* PRIVATE - DO NOT USE
|
|
@@ -1230,7 +1212,15 @@ interface Router$1 {
|
|
|
1230
1212
|
* Utility function to create an href for the given location
|
|
1231
1213
|
* @param location
|
|
1232
1214
|
*/
|
|
1233
|
-
createHref(location: Location | URL): string;
|
|
1215
|
+
createHref(location: Location$1 | URL): string;
|
|
1216
|
+
/**
|
|
1217
|
+
* @private
|
|
1218
|
+
* PRIVATE - DO NOT USE
|
|
1219
|
+
*
|
|
1220
|
+
* Utility function to create a URL for the given location
|
|
1221
|
+
* @param location
|
|
1222
|
+
*/
|
|
1223
|
+
createURL?(to: To): URL;
|
|
1234
1224
|
/**
|
|
1235
1225
|
* @private
|
|
1236
1226
|
* PRIVATE - DO NOT USE
|
|
@@ -1338,7 +1328,7 @@ interface RouterState {
|
|
|
1338
1328
|
/**
|
|
1339
1329
|
* The current location reflected by the router
|
|
1340
1330
|
*/
|
|
1341
|
-
location: Location;
|
|
1331
|
+
location: Location$1;
|
|
1342
1332
|
/**
|
|
1343
1333
|
* The current set of route matches
|
|
1344
1334
|
*/
|
|
@@ -1399,7 +1389,10 @@ type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "e
|
|
|
1399
1389
|
/**
|
|
1400
1390
|
* Future flags to toggle new feature behavior
|
|
1401
1391
|
*/
|
|
1402
|
-
interface FutureConfig {
|
|
1392
|
+
interface FutureConfig {
|
|
1393
|
+
/** Enables route-pattern matching after calling `unstable_preloadRoutePattern()`. */
|
|
1394
|
+
unstable_routePatternMatching?: boolean;
|
|
1395
|
+
}
|
|
1403
1396
|
/**
|
|
1404
1397
|
* Initialization options for createRouter
|
|
1405
1398
|
*/
|
|
@@ -1431,6 +1424,8 @@ interface StaticHandlerContext {
|
|
|
1431
1424
|
loaderHeaders: Record<string, Headers>;
|
|
1432
1425
|
actionHeaders: Record<string, Headers>;
|
|
1433
1426
|
_deepestRenderedBoundaryId?: string | null;
|
|
1427
|
+
/** @private */
|
|
1428
|
+
_match: StaticHandler["match"];
|
|
1434
1429
|
}
|
|
1435
1430
|
/**
|
|
1436
1431
|
* A StaticHandler instance manages a singular SSR navigation/fetch event
|
|
@@ -1444,10 +1439,10 @@ interface StaticHandler {
|
|
|
1444
1439
|
* @private
|
|
1445
1440
|
* PRIVATE - DO NOT USE
|
|
1446
1441
|
*
|
|
1447
|
-
*
|
|
1448
|
-
* matching
|
|
1442
|
+
* Match routes against a location using the handler's configured route
|
|
1443
|
+
* matching implementation.
|
|
1449
1444
|
*/
|
|
1450
|
-
|
|
1445
|
+
match(locationArg: Partial<Location$1> | string): DataRouteMatch[] | null;
|
|
1451
1446
|
/**
|
|
1452
1447
|
* Perform a query for a given request - executing all matched route
|
|
1453
1448
|
* loaders/actions. Used for document requests.
|
|
@@ -1495,8 +1490,8 @@ interface StaticHandler {
|
|
|
1495
1490
|
}): Promise<any>;
|
|
1496
1491
|
}
|
|
1497
1492
|
type ViewTransitionOpts = {
|
|
1498
|
-
currentLocation: Location;
|
|
1499
|
-
nextLocation: Location;
|
|
1493
|
+
currentLocation: Location$1;
|
|
1494
|
+
nextLocation: Location$1;
|
|
1500
1495
|
};
|
|
1501
1496
|
/**
|
|
1502
1497
|
* Subscriber function signature for changes to router state
|
|
@@ -1514,7 +1509,7 @@ interface RouterSubscriber {
|
|
|
1514
1509
|
* for a given location
|
|
1515
1510
|
*/
|
|
1516
1511
|
interface GetScrollRestorationKeyFunction {
|
|
1517
|
-
(location: Location, matches: UIMatch[]): string | null;
|
|
1512
|
+
(location: Location$1, matches: UIMatch[]): string | null;
|
|
1518
1513
|
}
|
|
1519
1514
|
/**
|
|
1520
1515
|
* Function signature for determining the current scroll position
|
|
@@ -1596,7 +1591,7 @@ type NavigationStates = {
|
|
|
1596
1591
|
};
|
|
1597
1592
|
Loading: {
|
|
1598
1593
|
state: "loading";
|
|
1599
|
-
location: Location;
|
|
1594
|
+
location: Location$1;
|
|
1600
1595
|
matches: DataRouteMatch[];
|
|
1601
1596
|
historyAction: Action;
|
|
1602
1597
|
formMethod: Submission["formMethod"] | undefined;
|
|
@@ -1608,7 +1603,7 @@ type NavigationStates = {
|
|
|
1608
1603
|
};
|
|
1609
1604
|
Submitting: {
|
|
1610
1605
|
state: "submitting";
|
|
1611
|
-
location: Location;
|
|
1606
|
+
location: Location$1;
|
|
1612
1607
|
matches: DataRouteMatch[];
|
|
1613
1608
|
historyAction: Action;
|
|
1614
1609
|
formMethod: Submission["formMethod"];
|
|
@@ -1698,7 +1693,7 @@ interface BlockerBlocked {
|
|
|
1698
1693
|
state: "blocked";
|
|
1699
1694
|
reset: () => void;
|
|
1700
1695
|
proceed: () => void;
|
|
1701
|
-
location: Location;
|
|
1696
|
+
location: Location$1;
|
|
1702
1697
|
}
|
|
1703
1698
|
interface BlockerUnblocked {
|
|
1704
1699
|
state: "unblocked";
|
|
@@ -1710,12 +1705,12 @@ interface BlockerProceeding {
|
|
|
1710
1705
|
state: "proceeding";
|
|
1711
1706
|
reset: undefined;
|
|
1712
1707
|
proceed: undefined;
|
|
1713
|
-
location: Location;
|
|
1708
|
+
location: Location$1;
|
|
1714
1709
|
}
|
|
1715
1710
|
type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding;
|
|
1716
1711
|
type BlockerFunction = (args: {
|
|
1717
|
-
currentLocation: Location;
|
|
1718
|
-
nextLocation: Location;
|
|
1712
|
+
currentLocation: Location$1;
|
|
1713
|
+
nextLocation: Location$1;
|
|
1719
1714
|
historyAction: Action;
|
|
1720
1715
|
}) => boolean;
|
|
1721
1716
|
interface CreateStaticHandlerOptions {
|
|
@@ -2000,7 +1995,7 @@ type MetaMatches<MatchLoaders extends Record<string, LoaderFunction | ClientLoad
|
|
|
2000
1995
|
interface MetaArgs<Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown, MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> {
|
|
2001
1996
|
loaderData: (Loader extends LoaderFunction | ClientLoaderFunction ? SerializeFrom<Loader> : unknown) | undefined;
|
|
2002
1997
|
params: Params;
|
|
2003
|
-
location: Location;
|
|
1998
|
+
location: Location$1;
|
|
2004
1999
|
matches: MetaMatches<MatchLoaders>;
|
|
2005
2000
|
error?: unknown;
|
|
2006
2001
|
}
|
|
@@ -2321,7 +2316,7 @@ type RSCRenderPayload = {
|
|
|
2321
2316
|
clientVersion?: string;
|
|
2322
2317
|
errors: Record<string, any> | null;
|
|
2323
2318
|
loaderData: Record<string, any>;
|
|
2324
|
-
location: Location;
|
|
2319
|
+
location: Location$1;
|
|
2325
2320
|
routeDiscovery: RouteDiscovery;
|
|
2326
2321
|
matches: RSCRouteMatch[];
|
|
2327
2322
|
patches?: Promise<RSCRouteManifest[]>;
|
|
@@ -2369,6 +2364,13 @@ type RouteDiscovery = {
|
|
|
2369
2364
|
* encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components)
|
|
2370
2365
|
* enabled client router.
|
|
2371
2366
|
*
|
|
2367
|
+
* Treat every React Server Function as a public endpoint. Server Functions are
|
|
2368
|
+
* not inherently associated with a route. Any route middleware that runs is
|
|
2369
|
+
* selected from the URL used to call a Server Function, but the client controls
|
|
2370
|
+
* both the Server Function identifier and the URL. Perform all access control
|
|
2371
|
+
* checks within each Server Function, or use a route action for
|
|
2372
|
+
* middleware-driven access control.
|
|
2373
|
+
*
|
|
2372
2374
|
* @example
|
|
2373
2375
|
* import {
|
|
2374
2376
|
* createTemporaryReferenceSet,
|