react-router 8.5.0 → 8.5.2
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 +70 -1
- 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 +75 -415
- package/dist/development/index-react-server.js +106 -20
- package/dist/development/index.js +1 -1
- package/dist/development/lib/actions.js +1 -1
- package/dist/development/lib/await.js +58 -0
- package/dist/development/lib/components.d.ts +65 -25
- package/dist/development/lib/components.js +69 -15
- package/dist/development/lib/context.d.ts +2 -2
- package/dist/development/lib/context.js +1 -1
- package/dist/development/lib/dom/dom.js +13 -4
- package/dist/development/lib/dom/lib.d.ts +2 -2
- package/dist/development/lib/dom/lib.js +11 -4
- package/dist/development/lib/dom/server.js +1 -1
- package/dist/development/lib/dom/ssr/components.js +1 -1
- package/dist/development/lib/dom/ssr/data.js +1 -1
- 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 +12 -3
- package/dist/development/lib/dom/ssr/hydration.d.ts +1 -0
- package/dist/development/lib/dom/ssr/hydration.js +1 -1
- 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 +1 -1
- package/dist/development/lib/dom/ssr/route-discovery.d.ts +2 -2
- package/dist/development/lib/dom/ssr/route-discovery.js +3 -3
- 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 +1 -1
- package/dist/development/lib/dom/ssr/single-fetch.d.ts +1 -1
- package/dist/development/lib/dom/ssr/single-fetch.js +7 -7
- package/dist/development/lib/dom-export/dom-router-provider.js +1 -1
- package/dist/development/lib/dom-export/hydrated-router.d.ts +1 -1
- package/dist/development/lib/dom-export/hydrated-router.js +5 -3
- package/dist/development/lib/errors.js +1 -1
- package/dist/development/lib/hooks.d.ts +0 -3
- package/dist/development/lib/hooks.js +13 -9
- package/dist/development/lib/href.js +4 -4
- 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.js +1 -1
- package/dist/development/lib/router/matcher-route-pattern.preload.js +1 -1
- package/dist/development/lib/router/matcher.js +6 -1
- package/dist/development/lib/router/navigation.js +17 -2
- package/dist/development/lib/router/router.d.ts +2 -0
- package/dist/development/lib/router/router.js +62 -29
- package/dist/development/lib/router/url.js +1 -1
- package/dist/development/lib/router/utils.d.ts +13 -5
- package/dist/development/lib/router/utils.js +17 -8
- package/dist/development/lib/rsc/browser.js +28 -5
- 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 +1 -1
- package/dist/development/lib/rsc/route-modules.js +1 -1
- package/dist/development/lib/rsc/server.rsc.d.ts +2 -0
- package/dist/development/lib/rsc/server.ssr.js +1 -1
- 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 +1 -1
- package/dist/development/lib/server-runtime/routes.js +1 -1
- package/dist/development/lib/server-runtime/server.js +21 -10
- 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 +2 -2
- 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/lib/types/route-module-annotations.d.ts +1 -1
- package/dist/development/route-pattern.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/flatten.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/turbo-stream.js +75 -66
- package/dist/development/vendor/turbo-stream-v2/unflatten.js +23 -3
- 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 +75 -415
- package/dist/production/index-react-server.js +106 -20
- package/dist/production/index.js +1 -1
- package/dist/production/lib/actions.js +1 -1
- package/dist/production/lib/await.js +58 -0
- package/dist/production/lib/components.d.ts +65 -25
- package/dist/production/lib/components.js +69 -15
- package/dist/production/lib/context.d.ts +2 -2
- package/dist/production/lib/context.js +1 -1
- package/dist/production/lib/dom/dom.js +13 -4
- package/dist/production/lib/dom/lib.d.ts +2 -2
- package/dist/production/lib/dom/lib.js +11 -4
- package/dist/production/lib/dom/server.js +1 -1
- package/dist/production/lib/dom/ssr/components.js +1 -1
- package/dist/production/lib/dom/ssr/data.js +1 -1
- 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 +12 -3
- package/dist/production/lib/dom/ssr/hydration.d.ts +1 -0
- package/dist/production/lib/dom/ssr/hydration.js +1 -1
- 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 +1 -1
- package/dist/production/lib/dom/ssr/route-discovery.d.ts +2 -2
- package/dist/production/lib/dom/ssr/route-discovery.js +3 -3
- 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 +1 -1
- package/dist/production/lib/dom/ssr/single-fetch.d.ts +1 -1
- package/dist/production/lib/dom/ssr/single-fetch.js +7 -7
- package/dist/production/lib/dom-export/dom-router-provider.js +1 -1
- package/dist/production/lib/dom-export/hydrated-router.d.ts +1 -1
- package/dist/production/lib/dom-export/hydrated-router.js +5 -3
- package/dist/production/lib/errors.js +1 -1
- package/dist/production/lib/hooks.d.ts +0 -3
- package/dist/production/lib/hooks.js +13 -9
- package/dist/production/lib/href.js +4 -4
- 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.js +1 -1
- package/dist/production/lib/router/matcher-route-pattern.preload.js +1 -1
- package/dist/production/lib/router/matcher.js +6 -1
- package/dist/production/lib/router/navigation.js +17 -2
- package/dist/production/lib/router/router.d.ts +2 -0
- package/dist/production/lib/router/router.js +62 -29
- package/dist/production/lib/router/url.js +1 -1
- package/dist/production/lib/router/utils.d.ts +13 -5
- package/dist/production/lib/router/utils.js +17 -8
- package/dist/production/lib/rsc/browser.js +28 -5
- 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 +1 -1
- package/dist/production/lib/rsc/route-modules.js +1 -1
- package/dist/production/lib/rsc/server.rsc.d.ts +2 -0
- package/dist/production/lib/rsc/server.ssr.js +1 -1
- 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 +1 -1
- package/dist/production/lib/server-runtime/routes.js +1 -1
- package/dist/production/lib/server-runtime/server.js +21 -10
- 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 +2 -2
- 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/lib/types/route-module-annotations.d.ts +1 -1
- package/dist/production/route-pattern.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/flatten.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/turbo-stream.js +75 -66
- package/dist/production/vendor/turbo-stream-v2/unflatten.js +23 -3
- package/dist/production/vendor/turbo-stream-v2/utils.js +1 -1
- package/docs/explanation/backend-for-frontend.md +0 -3
- package/docs/explanation/code-splitting.md +0 -3
- package/docs/explanation/concurrency.md +0 -3
- package/docs/explanation/hot-module-replacement.md +0 -3
- package/docs/explanation/lazy-route-discovery.md +0 -3
- package/docs/explanation/progressive-enhancement.md +0 -3
- package/docs/explanation/race-conditions.md +0 -3
- package/docs/explanation/react-transitions.md +0 -3
- package/docs/explanation/sessions-and-cookies.md +1 -1
- package/docs/explanation/state-management.md +0 -3
- package/docs/explanation/styling.md +0 -3
- package/docs/explanation/type-safety.md +0 -3
- package/docs/how-to/accessibility.md +0 -6
- package/docs/how-to/client-data.md +0 -3
- package/docs/how-to/data-strategy.md +0 -3
- package/docs/how-to/error-boundary.md +0 -3
- package/docs/how-to/error-reporting.md +0 -3
- package/docs/how-to/fetchers.md +0 -3
- package/docs/how-to/file-route-conventions.md +0 -3
- package/docs/how-to/file-uploads.md +0 -3
- package/docs/how-to/form-validation.md +0 -3
- package/docs/how-to/headers.md +0 -3
- package/docs/how-to/instrumentation.md +0 -3
- package/docs/how-to/middleware.md +6 -3
- package/docs/how-to/navigation-blocking.md +0 -3
- package/docs/how-to/optimize-revalidation.md +0 -3
- package/docs/how-to/pre-rendering.md +0 -3
- package/docs/how-to/presets.md +0 -3
- package/docs/how-to/react-server-components.md +0 -3
- package/docs/how-to/resource-routes.md +0 -3
- package/docs/how-to/route-discovery.md +4 -2
- package/docs/how-to/route-module-type-safety.md +0 -3
- package/docs/how-to/security.md +0 -3
- package/docs/how-to/server-bundles.md +0 -3
- package/docs/how-to/spa.md +0 -3
- package/docs/how-to/status.md +0 -3
- package/docs/how-to/suspense.md +22 -6
- package/docs/how-to/using-handle.md +0 -3
- package/docs/how-to/view-transitions.md +0 -3
- package/docs/start/framework/data-loading.md +9 -0
- package/docs/upgrading/future.md +0 -12
- package/docs/upgrading/v7.md +14 -33
- package/package.json +1 -1
- package/dist/development/lib/dom/global.d.ts +0 -35
- package/dist/production/lib/dom/global.d.ts +0 -35
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { ComponentType, ReactElement } from "react";
|
|
4
3
|
import { CookieParseOptions, CookieParseOptions as CookieParseOptions$1, CookieSerializeOptions, CookieSerializeOptions as CookieSerializeOptions$1 } from "cookie-es";
|
|
5
4
|
import { BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta, NavLink, Navigate, Outlet, Route, Router, RouterProvider, Routes, ScrollRestoration, StaticRouter, StaticRouterProvider, unstable_HistoryRouter } from "react-router/internal/react-server-client";
|
|
6
5
|
import { ReactFormState } from "react-dom/client";
|
|
@@ -353,6 +352,13 @@ interface DataFunctionArgs<Context> {
|
|
|
353
352
|
* In Framework mode, this is a normalized URL with React-Router-specific
|
|
354
353
|
* implementation details removed (`.data` suffixes, `index`/`_routes` search
|
|
355
354
|
* params). For the raw incoming URL, use `request.url`.
|
|
355
|
+
*
|
|
356
|
+
* This normalization preserves standard URL pathname encoding and casing.
|
|
357
|
+
* For example, a request to `/%61dmin.data` produces a `url.pathname` of
|
|
358
|
+
* `/%61dmin`. This is not a canonical representation of the matched route.
|
|
359
|
+
* For authorization, attach {@link https://reactrouter.com/how-to/middleware#authentication server middleware}
|
|
360
|
+
* to the protected route or a common ancestor instead of relying on literal
|
|
361
|
+
* pathname-prefix comparisons.
|
|
356
362
|
*/
|
|
357
363
|
url: URL;
|
|
358
364
|
/**
|
|
@@ -673,7 +679,7 @@ type BaseRouteObject = {
|
|
|
673
679
|
action?: ActionFunction | boolean;
|
|
674
680
|
/**
|
|
675
681
|
* The route shouldRevalidate function.
|
|
676
|
-
* See [`shouldRevalidate`](../../start/data/route-object#
|
|
682
|
+
* See [`shouldRevalidate`](../../start/data/route-object#shouldrevalidate).
|
|
677
683
|
*/
|
|
678
684
|
shouldRevalidate?: ShouldRevalidateFunction;
|
|
679
685
|
/**
|
|
@@ -837,30 +843,6 @@ interface UIMatch<Data = unknown, Handle = unknown> {
|
|
|
837
843
|
*/
|
|
838
844
|
handle: Handle;
|
|
839
845
|
}
|
|
840
|
-
interface RouteMeta<RouteObjectType extends RouteObject = RouteObject> {
|
|
841
|
-
relativePath: string;
|
|
842
|
-
caseSensitive: boolean;
|
|
843
|
-
childrenIndex: number;
|
|
844
|
-
route: RouteObjectType;
|
|
845
|
-
matcher?: RegExp;
|
|
846
|
-
compiledParams?: CompiledPathParam[];
|
|
847
|
-
}
|
|
848
|
-
/**
|
|
849
|
-
* @private
|
|
850
|
-
* PRIVATE - DO NOT USE
|
|
851
|
-
*
|
|
852
|
-
* A "branch" of routes that match a given route pattern.
|
|
853
|
-
* This is an internal interface not intended for direct external usage.
|
|
854
|
-
*/
|
|
855
|
-
interface RouteBranch<RouteObjectType extends RouteObject = RouteObject> {
|
|
856
|
-
path: string;
|
|
857
|
-
score: number;
|
|
858
|
-
routesMeta: RouteMeta<RouteObjectType>[];
|
|
859
|
-
}
|
|
860
|
-
type CompiledPathParam = {
|
|
861
|
-
paramName: string;
|
|
862
|
-
isOptional?: boolean;
|
|
863
|
-
};
|
|
864
846
|
declare class DataWithResponseInit<D> {
|
|
865
847
|
type: string;
|
|
866
848
|
data: D;
|
|
@@ -1025,18 +1007,6 @@ type ErrorResponse = {
|
|
|
1025
1007
|
declare function isRouteErrorResponse(error: any): error is ErrorResponse;
|
|
1026
1008
|
//#endregion
|
|
1027
1009
|
//#region lib/components.d.ts
|
|
1028
|
-
/**
|
|
1029
|
-
* Function signature for client side error handling for loader/actions errors
|
|
1030
|
-
* and rendering errors via `componentDidCatch`
|
|
1031
|
-
*/
|
|
1032
|
-
interface ClientOnErrorFunction {
|
|
1033
|
-
(error: unknown, info: {
|
|
1034
|
-
location: Location$1;
|
|
1035
|
-
params: Params;
|
|
1036
|
-
pattern: string;
|
|
1037
|
-
errorInfo?: React.ErrorInfo;
|
|
1038
|
-
}): void;
|
|
1039
|
-
}
|
|
1040
1010
|
interface AwaitResolveRenderFunction<Resolve = any> {
|
|
1041
1011
|
(data: Awaited<Resolve>): React.ReactNode;
|
|
1042
1012
|
}
|
|
@@ -1044,6 +1014,26 @@ interface AwaitResolveRenderFunction<Resolve = any> {
|
|
|
1044
1014
|
* @category Types
|
|
1045
1015
|
*/
|
|
1046
1016
|
interface AwaitProps<Resolve> {
|
|
1017
|
+
/**
|
|
1018
|
+
* <docs-warning>This prop is currently unstable and may change in minor or patch
|
|
1019
|
+
* releases.</docs-warning>
|
|
1020
|
+
*
|
|
1021
|
+
* A promise (or value) to read using React's `use()` API in client components.
|
|
1022
|
+
* Unlike `resolve` in client components, this accepts promise-like values
|
|
1023
|
+
* without modifying the source promise.
|
|
1024
|
+
*
|
|
1025
|
+
* `errorElement` handles promise rejections. Errors thrown while rendering
|
|
1026
|
+
* children bubble to the nearest React error boundary.
|
|
1027
|
+
*
|
|
1028
|
+
* ```tsx
|
|
1029
|
+
* <Await unstable_promise={reviewsPromise} errorElement={<ReviewsError />}>
|
|
1030
|
+
* {(reviews) => <Reviews items={reviews} />}
|
|
1031
|
+
* </Await>
|
|
1032
|
+
* ```
|
|
1033
|
+
*
|
|
1034
|
+
* Pass exactly one of `unstable_promise` or `resolve`.
|
|
1035
|
+
*/
|
|
1036
|
+
unstable_promise?: never;
|
|
1047
1037
|
/**
|
|
1048
1038
|
* When using a function, the resolved value is provided as the parameter.
|
|
1049
1039
|
*
|
|
@@ -1069,14 +1059,17 @@ interface AwaitProps<Resolve> {
|
|
|
1069
1059
|
*/
|
|
1070
1060
|
children: React.ReactNode | AwaitResolveRenderFunction<Resolve>;
|
|
1071
1061
|
/**
|
|
1072
|
-
* The error element renders instead of the `children` when the
|
|
1062
|
+
* The error element renders instead of the `children` when the
|
|
1063
|
+
* [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
|
|
1073
1064
|
* rejects.
|
|
1074
1065
|
*
|
|
1066
|
+
* When using `resolve`, errors thrown while rendering `children` are
|
|
1067
|
+
* also caught and rendered here. With `unstable_promise`, only promise
|
|
1068
|
+
* rejections are handled; errors thrown while rendering `children` bubble to
|
|
1069
|
+
* the nearest React error boundary.
|
|
1070
|
+
*
|
|
1075
1071
|
* ```tsx
|
|
1076
|
-
* <Await
|
|
1077
|
-
* errorElement={<div>Oops</div>}
|
|
1078
|
-
* resolve={reviewsPromise}
|
|
1079
|
-
* >
|
|
1072
|
+
* <Await resolve={reviewsPromise} errorElement={<div>Oops</div>}>
|
|
1080
1073
|
* <Reviews />
|
|
1081
1074
|
* </Await>
|
|
1082
1075
|
* ```
|
|
@@ -1085,10 +1078,7 @@ interface AwaitProps<Resolve> {
|
|
|
1085
1078
|
* child component
|
|
1086
1079
|
*
|
|
1087
1080
|
* ```tsx
|
|
1088
|
-
* <Await
|
|
1089
|
-
* errorElement={<ReviewsError />}
|
|
1090
|
-
* resolve={reviewsPromise}
|
|
1091
|
-
* >
|
|
1081
|
+
* <Await resolve={reviewsPromise} errorElement={<ReviewsError />}>
|
|
1092
1082
|
* <Reviews />
|
|
1093
1083
|
* </Await>
|
|
1094
1084
|
*
|
|
@@ -1145,11 +1135,40 @@ interface AwaitProps<Resolve> {
|
|
|
1145
1135
|
*/
|
|
1146
1136
|
resolve: Resolve;
|
|
1147
1137
|
}
|
|
1138
|
+
interface AwaitPromiseProps<Resolve> extends Omit<AwaitProps<Resolve>, "resolve" | "unstable_promise"> {
|
|
1139
|
+
resolve?: never;
|
|
1140
|
+
/**
|
|
1141
|
+
* A promise (or value) to read using React's `use()` API in client components.
|
|
1142
|
+
* Unlike `resolve` in client components, this accepts promise-like values
|
|
1143
|
+
* without modifying the source promise.
|
|
1144
|
+
*
|
|
1145
|
+
* `errorElement` handles promise rejections. Errors thrown while rendering
|
|
1146
|
+
* children bubble to the nearest React error boundary.
|
|
1147
|
+
*
|
|
1148
|
+
* ```tsx
|
|
1149
|
+
* <Await unstable_promise={reviewsPromise} errorElement={<ReviewsError />}>
|
|
1150
|
+
* {(reviews) => <Reviews items={reviews} />}
|
|
1151
|
+
* </Await>
|
|
1152
|
+
* ```
|
|
1153
|
+
*
|
|
1154
|
+
* Pass exactly one of `unstable_promise` or `resolve`.
|
|
1155
|
+
*/
|
|
1156
|
+
unstable_promise: Resolve;
|
|
1157
|
+
}
|
|
1148
1158
|
/**
|
|
1149
1159
|
* Used to render promise values with automatic error handling.
|
|
1150
1160
|
*
|
|
1161
|
+
* Passing the promise through `resolve` uses React Router-specific promise tracking, while passing
|
|
1162
|
+
* it through `unstable_promise` uses React's built-in [`use()`](https://react.dev/reference/react/use)
|
|
1163
|
+
* API.
|
|
1164
|
+
*
|
|
1151
1165
|
* **Note:** `<Await>` expects to be rendered inside a [`<React.Suspense>`](https://react.dev/reference/react/Suspense)
|
|
1152
1166
|
*
|
|
1167
|
+
* <docs-warning>The `unstable_promise` prop is currently unstable and may change in minor or patch
|
|
1168
|
+
* releases. We plan to stabilize `<Await promise>` and deprecate `<Await resolve>` during v8, and then
|
|
1169
|
+
* drop `<Await resolve>` in v9. Please see below for minor `errorElement` behavioral differences
|
|
1170
|
+
* between the two approaches.</docs-warning>
|
|
1171
|
+
*
|
|
1153
1172
|
* @example
|
|
1154
1173
|
* import { Await, useLoaderData } from "react-router";
|
|
1155
1174
|
*
|
|
@@ -1168,15 +1187,9 @@ interface AwaitProps<Resolve> {
|
|
|
1168
1187
|
* <h1>{book.title}</h1>
|
|
1169
1188
|
* <p>{book.description}</p>
|
|
1170
1189
|
* <React.Suspense fallback={<ReviewsSkeleton />}>
|
|
1171
|
-
* <Await
|
|
1172
|
-
*
|
|
1173
|
-
*
|
|
1174
|
-
* <div>Could not load reviews 😬</div>
|
|
1175
|
-
* }
|
|
1176
|
-
* children={(resolvedReviews) => (
|
|
1177
|
-
* <Reviews items={resolvedReviews} />
|
|
1178
|
-
* )}
|
|
1179
|
-
* />
|
|
1190
|
+
* <Await resolve={reviews} errorElement={<BookError />}>
|
|
1191
|
+
* {(resolvedReviews) => <Reviews items={resolvedReviews} />}
|
|
1192
|
+
* </Await>
|
|
1180
1193
|
* </React.Suspense>
|
|
1181
1194
|
* </div>
|
|
1182
1195
|
* );
|
|
@@ -1190,294 +1203,10 @@ interface AwaitProps<Resolve> {
|
|
|
1190
1203
|
* @param {AwaitProps.children} props.children n/a
|
|
1191
1204
|
* @param {AwaitProps.errorElement} props.errorElement n/a
|
|
1192
1205
|
* @param {AwaitProps.resolve} props.resolve n/a
|
|
1206
|
+
* @param {AwaitProps.unstable_promise} props.unstable_promise n/a
|
|
1193
1207
|
* @returns React element for the rendered awaited value
|
|
1194
1208
|
*/
|
|
1195
|
-
declare function Await$1<Resolve>(
|
|
1196
|
-
children,
|
|
1197
|
-
errorElement,
|
|
1198
|
-
resolve
|
|
1199
|
-
}: AwaitProps<Resolve>): React.JSX.Element;
|
|
1200
|
-
//#endregion
|
|
1201
|
-
//#region lib/server-runtime/serverHandoff.d.ts
|
|
1202
|
-
type ServerHandoff = {
|
|
1203
|
-
criticalCss?: CriticalCss;
|
|
1204
|
-
basename: string | undefined;
|
|
1205
|
-
future: FutureConfig$1;
|
|
1206
|
-
ssr: boolean;
|
|
1207
|
-
isSpaMode: boolean;
|
|
1208
|
-
unstable_apiOnly?: boolean;
|
|
1209
|
-
unstable_apiServerOrigin?: string;
|
|
1210
|
-
routeDiscovery: ServerBuild["routeDiscovery"];
|
|
1211
|
-
};
|
|
1212
|
-
//#endregion
|
|
1213
|
-
//#region lib/dom/global.d.ts
|
|
1214
|
-
type WindowReactRouterContext = ServerHandoff & {
|
|
1215
|
-
state: HydrationState;
|
|
1216
|
-
stream: ReadableStream<Uint8Array> | undefined;
|
|
1217
|
-
streamController: ReadableStreamDefaultController<Uint8Array>;
|
|
1218
|
-
};
|
|
1219
|
-
interface ViewTransition {
|
|
1220
|
-
finished: Promise<void>;
|
|
1221
|
-
ready: Promise<void>;
|
|
1222
|
-
updateCallbackDone: Promise<void>;
|
|
1223
|
-
skipTransition(): void;
|
|
1224
|
-
}
|
|
1225
|
-
declare global {
|
|
1226
|
-
var __staticRouterHydrationData: HydrationState | undefined;
|
|
1227
|
-
var __reactRouterVersion: string;
|
|
1228
|
-
interface Document {
|
|
1229
|
-
startViewTransition(cb: () => Promise<void> | void): ViewTransition;
|
|
1230
|
-
}
|
|
1231
|
-
var __reactRouterContext: WindowReactRouterContext | undefined;
|
|
1232
|
-
var __reactRouterManifest: AssetsManifest | undefined;
|
|
1233
|
-
var __reactRouterRouteModules: RouteModules | undefined;
|
|
1234
|
-
var __reactRouterDataRouter: Router$1 | undefined;
|
|
1235
|
-
var __reactRouterHdrActive: boolean;
|
|
1236
|
-
var $RefreshRuntime$: {
|
|
1237
|
-
performReactRefresh: () => void;
|
|
1238
|
-
} | undefined;
|
|
1239
|
-
}
|
|
1240
|
-
//#endregion
|
|
1241
|
-
//#region lib/dom/ssr/single-fetch.d.ts
|
|
1242
|
-
/**
|
|
1243
|
-
* Describes the operation that initiated an internal router request.
|
|
1244
|
-
*
|
|
1245
|
-
* Requests that reload fetchers as part of a navigation, revalidation, or
|
|
1246
|
-
* initialization redirect keep that initiating `type`. `fetcherKey` identifies
|
|
1247
|
-
* the fetcher being loaded, or is `null` when the request targets route loaders
|
|
1248
|
-
* or actions.
|
|
1249
|
-
*
|
|
1250
|
-
* `navigationType` is the history action (`"PUSH"`, `"REPLACE"`, or `"POP"`)
|
|
1251
|
-
* for navigation-initiated data requests, including reloaded fetchers. It is
|
|
1252
|
-
* `null` for initialization, fetcher, and revalidation requests. Manifest
|
|
1253
|
-
* requests have no navigation type.
|
|
1254
|
-
*/
|
|
1255
|
-
type RouterFetchContext = {
|
|
1256
|
-
type: "manifest";
|
|
1257
|
-
} | {
|
|
1258
|
-
type: "navigation";
|
|
1259
|
-
fetcherKey: string | null;
|
|
1260
|
-
navigationType: Action;
|
|
1261
|
-
} | {
|
|
1262
|
-
type: "initialization" | "fetcher" | "revalidation";
|
|
1263
|
-
fetcherKey: string | null;
|
|
1264
|
-
navigationType: null;
|
|
1265
|
-
};
|
|
1266
|
-
type RouterFetch = (request: Request, context: RouterFetchContext) => Promise<Response>;
|
|
1267
|
-
//#endregion
|
|
1268
|
-
//#region lib/dom/ssr/route-discovery.d.ts
|
|
1269
|
-
/** A discovery response from a different build. */
|
|
1270
|
-
type ManifestMismatchEvent = {
|
|
1271
|
-
source: "eager" | "navigation" | "fetcher" | "imperative";
|
|
1272
|
-
version: string;
|
|
1273
|
-
reloadUrl: string | null;
|
|
1274
|
-
loadAllRoutes(): Promise<void>;
|
|
1275
|
-
stopPropagation(): void; /** Run built-in recovery for this source, at most once per mismatch event. */
|
|
1276
|
-
defaultBehavior(): Promise<void>;
|
|
1277
|
-
};
|
|
1278
|
-
/** The result of imperative route discovery. */
|
|
1279
|
-
type DiscoveryResult = {
|
|
1280
|
-
type: "success";
|
|
1281
|
-
} | {
|
|
1282
|
-
type: "version-mismatch";
|
|
1283
|
-
} | {
|
|
1284
|
-
type: "aborted";
|
|
1285
|
-
};
|
|
1286
|
-
/** Options for {@link unstable_useRouteDiscovery}. */
|
|
1287
|
-
type RouteDiscoveryOptions = {
|
|
1288
|
-
onManifestMismatch?: (event: ManifestMismatchEvent) => void | Promise<void>;
|
|
1289
|
-
};
|
|
1290
|
-
type Registration = {
|
|
1291
|
-
current: RouteDiscoveryOptions;
|
|
1292
|
-
};
|
|
1293
|
-
type DiscoveryState = "partial" | "loading" | "complete";
|
|
1294
|
-
type RouteDiscoverySsrInfo = {
|
|
1295
|
-
manifest: AssetsManifest;
|
|
1296
|
-
routeModules: RouteModules;
|
|
1297
|
-
router: Router$1 | undefined;
|
|
1298
|
-
context: Pick<WindowReactRouterContext, "ssr" | "routeDiscovery" | "isSpaMode" | "basename" | "unstable_apiServerOrigin" | "unstable_apiOnly">;
|
|
1299
|
-
};
|
|
1300
|
-
declare class RouteDiscoveryRuntime {
|
|
1301
|
-
private ssrInfo;
|
|
1302
|
-
readonly enabled: boolean;
|
|
1303
|
-
readonly discoveredPaths: Set<string>;
|
|
1304
|
-
readonly nextPaths: Set<string>;
|
|
1305
|
-
state: DiscoveryState;
|
|
1306
|
-
ready: boolean;
|
|
1307
|
-
private registrations;
|
|
1308
|
-
private listeners;
|
|
1309
|
-
private fullLoadErrorListeners;
|
|
1310
|
-
private fullLoad?;
|
|
1311
|
-
private loadedManifest?;
|
|
1312
|
-
private mismatch?;
|
|
1313
|
-
private fetchImplementation;
|
|
1314
|
-
private loadManifest;
|
|
1315
|
-
onError?: ClientOnErrorFunction;
|
|
1316
|
-
constructor(ssrInfo: RouteDiscoverySsrInfo, {
|
|
1317
|
-
fetch: fetchImplementation,
|
|
1318
|
-
loadManifest
|
|
1319
|
-
}?: {
|
|
1320
|
-
fetch?: RouterFetch;
|
|
1321
|
-
loadManifest?: () => Promise<AssetsManifest>;
|
|
1322
|
-
});
|
|
1323
|
-
private get router();
|
|
1324
|
-
private loadManifestAsset;
|
|
1325
|
-
subscribe: (listener: () => void) => () => void;
|
|
1326
|
-
private update;
|
|
1327
|
-
markReady: () => void;
|
|
1328
|
-
register(registration: Registration): () => void;
|
|
1329
|
-
private isComplete;
|
|
1330
|
-
loadAllRoutes: () => Promise<void>;
|
|
1331
|
-
reportError(error: unknown): void;
|
|
1332
|
-
private dispatchMismatch;
|
|
1333
|
-
private requestUrl;
|
|
1334
|
-
discoverRoutes: (paths: string[], options?: {
|
|
1335
|
-
signal?: AbortSignal;
|
|
1336
|
-
}) => Promise<DiscoveryResult>;
|
|
1337
|
-
discover(paths: string[], source: ManifestMismatchEvent["source"], reloadUrl: string | null, signal?: AbortSignal, patch?: (routeId: string | null, children: RouteObject[], unstable_allowElementMutations?: boolean) => void): Promise<DiscoveryResult>;
|
|
1338
|
-
}
|
|
1339
|
-
//#endregion
|
|
1340
|
-
//#region lib/dom/ssr/entry.d.ts
|
|
1341
|
-
type SerializedError = {
|
|
1342
|
-
message: string;
|
|
1343
|
-
stack?: string;
|
|
1344
|
-
};
|
|
1345
|
-
interface FrameworkContextObject {
|
|
1346
|
-
routeDiscoveryRuntime?: RouteDiscoveryRuntime;
|
|
1347
|
-
routeDiscoveryState?: DiscoveryState;
|
|
1348
|
-
manifest: AssetsManifest;
|
|
1349
|
-
routeModules: RouteModules;
|
|
1350
|
-
criticalCss?: CriticalCss;
|
|
1351
|
-
serverHandoffString?: string;
|
|
1352
|
-
future: FutureConfig$1;
|
|
1353
|
-
ssr: boolean;
|
|
1354
|
-
isSpaMode: boolean;
|
|
1355
|
-
unstable_apiOnly?: boolean;
|
|
1356
|
-
unstable_apiServerOrigin?: string;
|
|
1357
|
-
routeDiscovery: ServerBuild["routeDiscovery"];
|
|
1358
|
-
nonce?: string;
|
|
1359
|
-
serializeError?(error: Error): SerializedError;
|
|
1360
|
-
renderMeta?: {
|
|
1361
|
-
didRenderScripts?: boolean;
|
|
1362
|
-
streamCache?: Record<number, Promise<void> & {
|
|
1363
|
-
result?: {
|
|
1364
|
-
done: boolean;
|
|
1365
|
-
value: string;
|
|
1366
|
-
};
|
|
1367
|
-
error?: unknown;
|
|
1368
|
-
}>;
|
|
1369
|
-
};
|
|
1370
|
-
}
|
|
1371
|
-
interface EntryContext extends FrameworkContextObject {
|
|
1372
|
-
/**
|
|
1373
|
-
* @deprecated This property was an internal implementation detail and was
|
|
1374
|
-
* never intended for use in `entry.server.tsx`. It is always an empty array.
|
|
1375
|
-
*/
|
|
1376
|
-
branches: RouteBranch<DataRouteObject>[];
|
|
1377
|
-
staticHandlerContext: StaticHandlerContext;
|
|
1378
|
-
serverHandoffStream?: ReadableStream<Uint8Array>;
|
|
1379
|
-
}
|
|
1380
|
-
interface FutureConfig$1 {
|
|
1381
|
-
unstable_customRouteDiscovery?: boolean;
|
|
1382
|
-
}
|
|
1383
|
-
type CriticalCss = string | {
|
|
1384
|
-
rel: "stylesheet";
|
|
1385
|
-
href: string;
|
|
1386
|
-
};
|
|
1387
|
-
interface AssetsManifest {
|
|
1388
|
-
entry: {
|
|
1389
|
-
imports: string[];
|
|
1390
|
-
module: string;
|
|
1391
|
-
};
|
|
1392
|
-
routes: RouteManifest<EntryRoute>;
|
|
1393
|
-
url: string;
|
|
1394
|
-
version: string;
|
|
1395
|
-
hmr?: {
|
|
1396
|
-
timestamp?: number;
|
|
1397
|
-
runtime: string;
|
|
1398
|
-
};
|
|
1399
|
-
sri?: Record<string, string> | true;
|
|
1400
|
-
}
|
|
1401
|
-
//#endregion
|
|
1402
|
-
//#region lib/server-runtime/routes.d.ts
|
|
1403
|
-
type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
|
|
1404
|
-
interface ServerRoute extends Route$1 {
|
|
1405
|
-
children: ServerRoute[];
|
|
1406
|
-
module: ServerRouteModule;
|
|
1407
|
-
}
|
|
1408
|
-
//#endregion
|
|
1409
|
-
//#region lib/server-runtime/build.d.ts
|
|
1410
|
-
type OptionalCriticalCss = CriticalCss | undefined;
|
|
1411
|
-
/**
|
|
1412
|
-
* The output of the compiler for the server build.
|
|
1413
|
-
*/
|
|
1414
|
-
interface ServerBuild {
|
|
1415
|
-
entry: {
|
|
1416
|
-
module: ServerEntryModule;
|
|
1417
|
-
};
|
|
1418
|
-
routes: ServerRouteManifest;
|
|
1419
|
-
assets: AssetsManifest;
|
|
1420
|
-
basename?: string;
|
|
1421
|
-
publicPath: string;
|
|
1422
|
-
assetsBuildDirectory: string;
|
|
1423
|
-
future: FutureConfig$1;
|
|
1424
|
-
/**
|
|
1425
|
-
* Whether runtime server requests are supported, including API-only builds.
|
|
1426
|
-
*/
|
|
1427
|
-
ssr: boolean;
|
|
1428
|
-
/**
|
|
1429
|
-
* The origin to use for server requests in API-only mode.
|
|
1430
|
-
* @internal
|
|
1431
|
-
*/
|
|
1432
|
-
unstable_apiServerOrigin?: string;
|
|
1433
|
-
/**
|
|
1434
|
-
* Whether production document rendering is disabled while data and route
|
|
1435
|
-
* discovery requests remain supported.
|
|
1436
|
-
* @internal
|
|
1437
|
-
*/
|
|
1438
|
-
unstable_apiOnly?: boolean;
|
|
1439
|
-
unstable_getCriticalCss?: (args: {
|
|
1440
|
-
pathname: string;
|
|
1441
|
-
}) => OptionalCriticalCss | Promise<OptionalCriticalCss>;
|
|
1442
|
-
/**
|
|
1443
|
-
* @deprecated This is now done via a custom header during prerendering
|
|
1444
|
-
*/
|
|
1445
|
-
isSpaMode: boolean;
|
|
1446
|
-
prerender: string[];
|
|
1447
|
-
routeDiscovery: {
|
|
1448
|
-
mode: "lazy" | "initial";
|
|
1449
|
-
manifestPath: string;
|
|
1450
|
-
};
|
|
1451
|
-
allowedActionOrigins?: string[] | false;
|
|
1452
|
-
}
|
|
1453
|
-
interface HandleDocumentRequestFunction {
|
|
1454
|
-
(request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: RouterContextProvider): Promise<Response> | Response;
|
|
1455
|
-
}
|
|
1456
|
-
interface HandleDataRequestFunction {
|
|
1457
|
-
(response: Response, args: {
|
|
1458
|
-
request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
|
|
1459
|
-
context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
|
|
1460
|
-
params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
|
|
1461
|
-
}): Promise<Response> | Response;
|
|
1462
|
-
}
|
|
1463
|
-
interface HandleErrorFunction {
|
|
1464
|
-
(error: unknown, args: {
|
|
1465
|
-
request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
|
|
1466
|
-
context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
|
|
1467
|
-
params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
|
|
1468
|
-
}): void;
|
|
1469
|
-
}
|
|
1470
|
-
/**
|
|
1471
|
-
* A module that serves as the entry point for a Remix app during server
|
|
1472
|
-
* rendering.
|
|
1473
|
-
*/
|
|
1474
|
-
interface ServerEntryModule {
|
|
1475
|
-
default: HandleDocumentRequestFunction;
|
|
1476
|
-
handleDataRequest?: HandleDataRequestFunction;
|
|
1477
|
-
handleError?: HandleErrorFunction;
|
|
1478
|
-
instrumentations?: ServerInstrumentation[];
|
|
1479
|
-
streamTimeout?: number;
|
|
1480
|
-
}
|
|
1209
|
+
declare function Await$1<Resolve>(props: AwaitProps<Resolve> | AwaitPromiseProps<Resolve>): React.JSX.Element;
|
|
1481
1210
|
//#endregion
|
|
1482
1211
|
//#region lib/router/instrumentation.d.ts
|
|
1483
1212
|
type ServerInstrumentation = {
|
|
@@ -1937,6 +1666,8 @@ interface StaticHandler {
|
|
|
1937
1666
|
* The set of data routes managed by this handler
|
|
1938
1667
|
*/
|
|
1939
1668
|
dataRoutes: DataRouteObject[];
|
|
1669
|
+
/** @private Estimated route metadata visits per regex match. */
|
|
1670
|
+
readonly _matchCost?: number;
|
|
1940
1671
|
/**
|
|
1941
1672
|
* @private
|
|
1942
1673
|
* PRIVATE - DO NOT USE
|
|
@@ -2257,31 +1988,6 @@ interface CreateStaticHandlerOptions {
|
|
|
2257
1988
|
*/
|
|
2258
1989
|
declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;
|
|
2259
1990
|
//#endregion
|
|
2260
|
-
//#region lib/dom/ssr/routes.d.ts
|
|
2261
|
-
interface Route$1 {
|
|
2262
|
-
index?: boolean;
|
|
2263
|
-
caseSensitive?: boolean;
|
|
2264
|
-
id: string;
|
|
2265
|
-
parentId?: string;
|
|
2266
|
-
path?: string;
|
|
2267
|
-
}
|
|
2268
|
-
interface EntryRoute extends Route$1 {
|
|
2269
|
-
hasAction: boolean;
|
|
2270
|
-
hasLoader: boolean;
|
|
2271
|
-
hasClientAction: boolean;
|
|
2272
|
-
hasClientLoader: boolean;
|
|
2273
|
-
hasClientMiddleware: boolean;
|
|
2274
|
-
hasErrorBoundary: boolean;
|
|
2275
|
-
imports?: string[];
|
|
2276
|
-
css?: string[];
|
|
2277
|
-
module: string;
|
|
2278
|
-
clientActionModule: string | undefined;
|
|
2279
|
-
clientLoaderModule: string | undefined;
|
|
2280
|
-
clientMiddlewareModule: string | undefined;
|
|
2281
|
-
hydrateFallbackModule: string | undefined;
|
|
2282
|
-
parentId?: string;
|
|
2283
|
-
}
|
|
2284
|
-
//#endregion
|
|
2285
1991
|
//#region lib/router/links.d.ts
|
|
2286
1992
|
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
2287
1993
|
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
@@ -2469,36 +2175,6 @@ type ClientDataFunctionArgs<Params> = {
|
|
|
2469
2175
|
type SerializeFrom<T> = T extends ((...args: infer Args) => unknown) ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs | ClientDataFunctionArgs<unknown>] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
|
|
2470
2176
|
//#endregion
|
|
2471
2177
|
//#region lib/dom/ssr/routeModules.d.ts
|
|
2472
|
-
interface RouteModules {
|
|
2473
|
-
[routeId: string]: RouteModule | undefined;
|
|
2474
|
-
}
|
|
2475
|
-
/**
|
|
2476
|
-
* The shape of a route module shipped to the client
|
|
2477
|
-
*/
|
|
2478
|
-
interface RouteModule {
|
|
2479
|
-
clientAction?: ClientActionFunction;
|
|
2480
|
-
clientLoader?: ClientLoaderFunction;
|
|
2481
|
-
clientMiddleware?: MiddlewareFunction<Record<string, DataStrategyResult>>[];
|
|
2482
|
-
ErrorBoundary?: ErrorBoundaryComponent;
|
|
2483
|
-
HydrateFallback?: HydrateFallbackComponent;
|
|
2484
|
-
Layout?: LayoutComponent;
|
|
2485
|
-
default: RouteComponent;
|
|
2486
|
-
handle?: RouteHandle;
|
|
2487
|
-
links?: LinksFunction;
|
|
2488
|
-
meta?: MetaFunction;
|
|
2489
|
-
shouldRevalidate?: ShouldRevalidateFunction;
|
|
2490
|
-
}
|
|
2491
|
-
/**
|
|
2492
|
-
* The shape of a route module on the server
|
|
2493
|
-
*/
|
|
2494
|
-
interface ServerRouteModule extends RouteModule {
|
|
2495
|
-
action?: ActionFunction;
|
|
2496
|
-
headers?: HeadersFunction | {
|
|
2497
|
-
[name: string]: string;
|
|
2498
|
-
};
|
|
2499
|
-
loader?: LoaderFunction;
|
|
2500
|
-
middleware?: MiddlewareFunction<Response>[];
|
|
2501
|
-
}
|
|
2502
2178
|
/**
|
|
2503
2179
|
* A function that handles data mutations for a route on the client
|
|
2504
2180
|
*/
|
|
@@ -2521,10 +2197,6 @@ type ClientLoaderFunction = ((args: ClientLoaderFunctionArgs) => ReturnType<Load
|
|
|
2521
2197
|
type ClientLoaderFunctionArgs = LoaderFunctionArgs & {
|
|
2522
2198
|
serverLoader: <T = unknown>() => Promise<SerializeFrom<T>>;
|
|
2523
2199
|
};
|
|
2524
|
-
/**
|
|
2525
|
-
* ErrorBoundary to display for this route
|
|
2526
|
-
*/
|
|
2527
|
-
type ErrorBoundaryComponent = ComponentType;
|
|
2528
2200
|
type HeadersArgs = {
|
|
2529
2201
|
loaderHeaders: Headers;
|
|
2530
2202
|
parentHeaders: Headers;
|
|
@@ -2538,19 +2210,6 @@ type HeadersArgs = {
|
|
|
2538
2210
|
interface HeadersFunction {
|
|
2539
2211
|
(args: HeadersArgs): Headers | HeadersInit;
|
|
2540
2212
|
}
|
|
2541
|
-
/**
|
|
2542
|
-
* `<Route HydrateFallback>` component to render on initial loads
|
|
2543
|
-
* when client loaders are present
|
|
2544
|
-
*/
|
|
2545
|
-
type HydrateFallbackComponent = ComponentType;
|
|
2546
|
-
/**
|
|
2547
|
-
* Optional, root-only `<Route Layout>` component to wrap the root content in.
|
|
2548
|
-
* Useful for defining the <html>/<head>/<body> document shell shared by the
|
|
2549
|
-
* Component, HydrateFallback, and ErrorBoundary
|
|
2550
|
-
*/
|
|
2551
|
-
type LayoutComponent = ComponentType<{
|
|
2552
|
-
children: ReactElement<unknown, ErrorBoundaryComponent | HydrateFallbackComponent | RouteComponent>;
|
|
2553
|
-
}>;
|
|
2554
2213
|
/**
|
|
2555
2214
|
* A function that defines `<link>` tags to be inserted into the `<head>` of
|
|
2556
2215
|
* the document on route transitions.
|
|
@@ -2658,7 +2317,6 @@ type LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray;
|
|
|
2658
2317
|
/**
|
|
2659
2318
|
* A React component that is rendered for a route.
|
|
2660
2319
|
*/
|
|
2661
|
-
type RouteComponent = ComponentType<{}>;
|
|
2662
2320
|
/**
|
|
2663
2321
|
* An arbitrary object that is associated with a route.
|
|
2664
2322
|
*
|
|
@@ -2676,6 +2334,7 @@ type RSCRouteConfigEntryBase = {
|
|
|
2676
2334
|
action?: ActionFunction;
|
|
2677
2335
|
clientAction?: ClientActionFunction;
|
|
2678
2336
|
clientLoader?: ClientLoaderFunction;
|
|
2337
|
+
clientMiddleware?: MiddlewareFunction<any>[];
|
|
2679
2338
|
ErrorBoundary?: React.ComponentType<any>;
|
|
2680
2339
|
handle?: any;
|
|
2681
2340
|
headers?: HeadersFunction;
|
|
@@ -2707,6 +2366,7 @@ type RSCRouteConfig = Array<RSCRouteConfigEntry>;
|
|
|
2707
2366
|
type RSCRouteManifest = {
|
|
2708
2367
|
clientAction?: ClientActionFunction;
|
|
2709
2368
|
clientLoader?: ClientLoaderFunction;
|
|
2369
|
+
clientMiddleware?: MiddlewareFunction<any>[];
|
|
2710
2370
|
element?: React.ReactElement | false;
|
|
2711
2371
|
errorElement?: React.ReactElement;
|
|
2712
2372
|
handle?: any;
|