react-router 0.0.0-experimental-73e447577 → 0.0.0-experimental-e613d4238
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 +35 -0
- package/dist/development/{chunk-NKIXC2FA.mjs → chunk-2YVPYFDJ.mjs} +120 -131
- package/dist/development/{chunk-PF7FO4KS.mjs → chunk-5P3HEZQU.mjs} +145 -310
- package/dist/development/{chunk-SOMUQ5BV.js → chunk-XXC4LMW2.js} +265 -154
- package/dist/development/{chunk-WQE2SM7S.js → chunk-YJ6T7YSE.js} +72 -348
- package/dist/development/{router-2BoB34m1.d.mts → context-BqL5Eckq.d.mts} +1288 -1441
- package/dist/development/dom-export.d.mts +4 -59
- package/dist/development/dom-export.d.ts +3 -59
- package/dist/development/dom-export.js +5 -8
- package/dist/development/dom-export.mjs +5 -8
- package/dist/{production/index-react-server-client-BDG19ZQl.d.mts → development/index-react-server-client-2EDmGlsZ.d.mts} +77 -140
- package/dist/development/{index-react-server-client-BDG19ZQl.d.mts → index-react-server-client-DKvU8YRr.d.ts} +134 -198
- package/dist/development/index-react-server-client.d.mts +3 -3
- package/dist/development/index-react-server-client.d.ts +2 -3
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +1 -106
- package/dist/development/index-react-server.d.ts +1 -106
- package/dist/development/index-react-server.js +12 -182
- package/dist/development/index-react-server.mjs +12 -182
- package/dist/development/index.d.mts +18 -13
- package/dist/development/index.d.ts +16 -13
- package/dist/development/index.js +214 -223
- package/dist/development/index.mjs +5 -3
- package/dist/development/lib/types/internal.d.mts +3 -3
- package/dist/development/lib/types/internal.d.ts +2 -3
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-DiOIlEq5.d.mts → register-BrVEYTED.d.mts} +7 -1
- package/dist/{production/register-DiOIlEq5.d.mts → development/register-D8NQoPsO.d.ts} +7 -1
- package/dist/development/{routeModules-CtCOLGtG.d.mts → route-data-CDwqkzPE.d.mts} +147 -157
- package/dist/{production/routeModules-Bu1JamQV.d.ts → development/routeModules-BmVo7q9e.d.ts} +1046 -73
- package/dist/production/{chunk-TUGDEB6V.mjs → chunk-5MHETEIL.mjs} +120 -131
- package/dist/production/{chunk-TA3WUUL6.js → chunk-E4G6PZCJ.js} +265 -154
- package/dist/production/{chunk-VRFRIIGI.js → chunk-QBUHFRYZ.js} +72 -348
- package/dist/production/{chunk-YUNRQEIK.mjs → chunk-VNGQS422.mjs} +145 -310
- package/dist/production/{router-2BoB34m1.d.mts → context-BqL5Eckq.d.mts} +1288 -1441
- package/dist/production/dom-export.d.mts +4 -59
- package/dist/production/dom-export.d.ts +3 -59
- package/dist/production/dom-export.js +5 -8
- package/dist/production/dom-export.mjs +5 -8
- package/dist/{development/index-react-server-client-83aVZHgI.d.ts → production/index-react-server-client-2EDmGlsZ.d.mts} +77 -140
- package/dist/production/{index-react-server-client-83aVZHgI.d.ts → index-react-server-client-DKvU8YRr.d.ts} +134 -198
- package/dist/production/index-react-server-client.d.mts +3 -3
- package/dist/production/index-react-server-client.d.ts +2 -3
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +1 -106
- package/dist/production/index-react-server.d.ts +1 -106
- package/dist/production/index-react-server.js +12 -182
- package/dist/production/index-react-server.mjs +12 -182
- package/dist/production/index.d.mts +18 -13
- package/dist/production/index.d.ts +16 -13
- package/dist/production/index.js +214 -223
- package/dist/production/index.mjs +5 -3
- package/dist/production/lib/types/internal.d.mts +3 -3
- package/dist/production/lib/types/internal.d.ts +2 -3
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/register-DiOIlEq5.d.ts → production/register-BrVEYTED.d.mts} +7 -1
- package/dist/production/{register-DiOIlEq5.d.ts → register-D8NQoPsO.d.ts} +7 -1
- package/dist/production/{routeModules-CtCOLGtG.d.mts → route-data-CDwqkzPE.d.mts} +147 -157
- package/dist/{development/routeModules-Bu1JamQV.d.ts → production/routeModules-BmVo7q9e.d.ts} +1046 -73
- package/package.json +1 -1
- package/dist/development/instrumentation-XYmrzhe3.d.ts +0 -1138
- package/dist/production/instrumentation-XYmrzhe3.d.ts +0 -1138
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
+
## 7.9.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Do not try to use `turbo-stream` to decode CDN errors that never reached the server ([#14385](https://github.com/remix-run/react-router/pull/14385))
|
|
8
|
+
- We used to do this but lost this check with the adoption of single fetch
|
|
9
|
+
|
|
10
|
+
- Fix Data Mode regression causing a 404 during initial load in when `middleware` exists without any `loader` functions ([#14393](https://github.com/remix-run/react-router/pull/14393))
|
|
11
|
+
|
|
12
|
+
## 7.9.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- - Update client-side router to run client `middleware` on initial load even if no loaders exist ([#14348](https://github.com/remix-run/react-router/pull/14348))
|
|
17
|
+
- Update `createRoutesStub` to run route middleware
|
|
18
|
+
- You will need to set the `<RoutesStub future={{ v8_middleware: true }} />` flag to enable the proper `context` type
|
|
19
|
+
|
|
20
|
+
- Update Lazy Route Discovery manifest requests to use a singular comma-separated `paths` query param instead of repeated `p` query params ([#14321](https://github.com/remix-run/react-router/pull/14321))
|
|
21
|
+
- This is because Cloudflare has a hard limit of 100 URL search param key/value pairs when used as a key for caching purposes
|
|
22
|
+
- If more that 100 paths were included, the cache key would be incomplete and could produce false-positive cache hits
|
|
23
|
+
|
|
24
|
+
- \[UNSTABLE] Add `fetcher.unstable_reset()` API ([#14206](https://github.com/remix-run/react-router/pull/14206))
|
|
25
|
+
|
|
26
|
+
- Made useOutlet element reference have stable identity in-between route chages ([#13382](https://github.com/remix-run/react-router/pull/13382))
|
|
27
|
+
|
|
28
|
+
- feat: enable full transition support for the rsc router ([#14362](https://github.com/remix-run/react-router/pull/14362))
|
|
29
|
+
|
|
30
|
+
- In RSC Data Mode, handle SSR'd client errors and re-try in the browser ([#14342](https://github.com/remix-run/react-router/pull/14342))
|
|
31
|
+
|
|
32
|
+
- Support `middleware` prop on `<Route>` for usage with a data router via `createRoutesFromElements` ([#14357](https://github.com/remix-run/react-router/pull/14357))
|
|
33
|
+
|
|
34
|
+
- Handle encoded question mark and hash characters in ancestor splat routes ([#14249](https://github.com/remix-run/react-router/pull/14249))
|
|
35
|
+
|
|
36
|
+
- Fail gracefully on manifest version mismatch logic if `sessionStorage` access is blocked ([#14335](https://github.com/remix-run/react-router/pull/14335))
|
|
37
|
+
|
|
3
38
|
## 7.9.1
|
|
4
39
|
|
|
5
40
|
### Patch Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-e613d4238
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
SingleFetchRedirectSymbol,
|
|
23
23
|
StaticRouterProvider,
|
|
24
24
|
StreamTransfer,
|
|
25
|
+
UNSTABLE_TransitionEnabledRouterProvider,
|
|
25
26
|
convertRoutesToDataRoutes,
|
|
26
27
|
createBrowserHistory,
|
|
27
28
|
createContext,
|
|
@@ -37,7 +38,6 @@ import {
|
|
|
37
38
|
getManifestPath,
|
|
38
39
|
getSingleFetchDataStrategyImpl,
|
|
39
40
|
getStaticContextFromError,
|
|
40
|
-
instrumentHandler,
|
|
41
41
|
invariant,
|
|
42
42
|
isDataWithResponseInit,
|
|
43
43
|
isMutationMethod,
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
withComponentProps,
|
|
61
61
|
withErrorBoundaryProps,
|
|
62
62
|
withHydrateFallbackProps
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-5P3HEZQU.mjs";
|
|
64
64
|
|
|
65
65
|
// lib/dom/ssr/server.tsx
|
|
66
66
|
import * as React from "react";
|
|
@@ -517,8 +517,7 @@ async function callRouteHandler(handler, args) {
|
|
|
517
517
|
let result = await handler({
|
|
518
518
|
request: stripRoutesParam(stripIndexParam2(args.request)),
|
|
519
519
|
params: args.params,
|
|
520
|
-
context: args.context
|
|
521
|
-
pattern: args.pattern
|
|
520
|
+
context: args.context
|
|
522
521
|
});
|
|
523
522
|
if (isDataWithResponseInit(result) && result.init && result.init.status && isRedirectStatusCode(result.init.status)) {
|
|
524
523
|
throw new Response(null, result.init);
|
|
@@ -1011,8 +1010,7 @@ function derive(build, mode) {
|
|
|
1011
1010
|
let dataRoutes = createStaticHandlerDataRoutes(build.routes, build.future);
|
|
1012
1011
|
let serverMode = isServerMode(mode) ? mode : "production" /* Production */;
|
|
1013
1012
|
let staticHandler = createStaticHandler(dataRoutes, {
|
|
1014
|
-
basename: build.basename
|
|
1015
|
-
unstable_instrumentations: build.entry.module.unstable_instrumentations
|
|
1013
|
+
basename: build.basename
|
|
1016
1014
|
});
|
|
1017
1015
|
let errorHandler = build.entry.module.handleError || ((error, { request }) => {
|
|
1018
1016
|
if (serverMode !== "test" /* Test */ && !request.signal.aborted) {
|
|
@@ -1022,7 +1020,35 @@ function derive(build, mode) {
|
|
|
1022
1020
|
);
|
|
1023
1021
|
}
|
|
1024
1022
|
});
|
|
1025
|
-
|
|
1023
|
+
return {
|
|
1024
|
+
routes,
|
|
1025
|
+
dataRoutes,
|
|
1026
|
+
serverMode,
|
|
1027
|
+
staticHandler,
|
|
1028
|
+
errorHandler
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
var createRequestHandler = (build, mode) => {
|
|
1032
|
+
let _build;
|
|
1033
|
+
let routes;
|
|
1034
|
+
let serverMode;
|
|
1035
|
+
let staticHandler;
|
|
1036
|
+
let errorHandler;
|
|
1037
|
+
return async function requestHandler(request, initialContext) {
|
|
1038
|
+
_build = typeof build === "function" ? await build() : build;
|
|
1039
|
+
if (typeof build === "function") {
|
|
1040
|
+
let derived = derive(_build, mode);
|
|
1041
|
+
routes = derived.routes;
|
|
1042
|
+
serverMode = derived.serverMode;
|
|
1043
|
+
staticHandler = derived.staticHandler;
|
|
1044
|
+
errorHandler = derived.errorHandler;
|
|
1045
|
+
} else if (!routes || !serverMode || !staticHandler || !errorHandler) {
|
|
1046
|
+
let derived = derive(_build, mode);
|
|
1047
|
+
routes = derived.routes;
|
|
1048
|
+
serverMode = derived.serverMode;
|
|
1049
|
+
staticHandler = derived.staticHandler;
|
|
1050
|
+
errorHandler = derived.errorHandler;
|
|
1051
|
+
}
|
|
1026
1052
|
let params = {};
|
|
1027
1053
|
let loadContext;
|
|
1028
1054
|
let handleError = (error) => {
|
|
@@ -1035,7 +1061,7 @@ function derive(build, mode) {
|
|
|
1035
1061
|
request
|
|
1036
1062
|
});
|
|
1037
1063
|
};
|
|
1038
|
-
if (
|
|
1064
|
+
if (_build.future.v8_middleware) {
|
|
1039
1065
|
if (initialContext && !(initialContext instanceof RouterContextProvider)) {
|
|
1040
1066
|
let error = new Error(
|
|
1041
1067
|
"Invalid `context` value provided to `handleRequest`. When middleware is enabled you must return an instance of `RouterContextProvider` from your `getLoadContext` function."
|
|
@@ -1048,7 +1074,7 @@ function derive(build, mode) {
|
|
|
1048
1074
|
loadContext = initialContext || {};
|
|
1049
1075
|
}
|
|
1050
1076
|
let url = new URL(request.url);
|
|
1051
|
-
let normalizedBasename =
|
|
1077
|
+
let normalizedBasename = _build.basename || "/";
|
|
1052
1078
|
let normalizedPath = url.pathname;
|
|
1053
1079
|
if (stripBasename(normalizedPath, normalizedBasename) === "/_root.data") {
|
|
1054
1080
|
normalizedPath = normalizedBasename;
|
|
@@ -1059,7 +1085,7 @@ function derive(build, mode) {
|
|
|
1059
1085
|
normalizedPath = normalizedPath.slice(0, -1);
|
|
1060
1086
|
}
|
|
1061
1087
|
let isSpaMode = getBuildTimeHeader(request, "X-React-Router-SPA-Mode") === "yes";
|
|
1062
|
-
if (!
|
|
1088
|
+
if (!_build.ssr) {
|
|
1063
1089
|
let decodedPath = decodeURI(normalizedPath);
|
|
1064
1090
|
if (normalizedBasename !== "/") {
|
|
1065
1091
|
let strippedPath = stripBasename(decodedPath, normalizedBasename);
|
|
@@ -1083,9 +1109,9 @@ function derive(build, mode) {
|
|
|
1083
1109
|
}
|
|
1084
1110
|
decodedPath = strippedPath;
|
|
1085
1111
|
}
|
|
1086
|
-
if (
|
|
1112
|
+
if (_build.prerender.length === 0) {
|
|
1087
1113
|
isSpaMode = true;
|
|
1088
|
-
} else if (!
|
|
1114
|
+
} else if (!_build.prerender.includes(decodedPath) && !_build.prerender.includes(decodedPath + "/")) {
|
|
1089
1115
|
if (url.pathname.endsWith(".data")) {
|
|
1090
1116
|
errorHandler(
|
|
1091
1117
|
new ErrorResponseImpl(
|
|
@@ -1109,19 +1135,19 @@ function derive(build, mode) {
|
|
|
1109
1135
|
}
|
|
1110
1136
|
}
|
|
1111
1137
|
let manifestUrl = getManifestPath(
|
|
1112
|
-
|
|
1138
|
+
_build.routeDiscovery.manifestPath,
|
|
1113
1139
|
normalizedBasename
|
|
1114
1140
|
);
|
|
1115
1141
|
if (url.pathname === manifestUrl) {
|
|
1116
1142
|
try {
|
|
1117
|
-
let res = await handleManifestRequest(
|
|
1143
|
+
let res = await handleManifestRequest(_build, routes, url);
|
|
1118
1144
|
return res;
|
|
1119
1145
|
} catch (e) {
|
|
1120
1146
|
handleError(e);
|
|
1121
1147
|
return new Response("Unknown Server Error", { status: 500 });
|
|
1122
1148
|
}
|
|
1123
1149
|
}
|
|
1124
|
-
let matches = matchServerRoutes(routes, normalizedPath,
|
|
1150
|
+
let matches = matchServerRoutes(routes, normalizedPath, _build.basename);
|
|
1125
1151
|
if (matches && matches.length > 0) {
|
|
1126
1152
|
Object.assign(params, matches[0].params);
|
|
1127
1153
|
}
|
|
@@ -1132,11 +1158,11 @@ function derive(build, mode) {
|
|
|
1132
1158
|
let singleFetchMatches = matchServerRoutes(
|
|
1133
1159
|
routes,
|
|
1134
1160
|
handlerUrl.pathname,
|
|
1135
|
-
|
|
1161
|
+
_build.basename
|
|
1136
1162
|
);
|
|
1137
1163
|
response = await handleSingleFetchRequest(
|
|
1138
1164
|
serverMode,
|
|
1139
|
-
|
|
1165
|
+
_build,
|
|
1140
1166
|
staticHandler,
|
|
1141
1167
|
request,
|
|
1142
1168
|
handlerUrl,
|
|
@@ -1147,12 +1173,12 @@ function derive(build, mode) {
|
|
|
1147
1173
|
response = generateSingleFetchRedirectResponse(
|
|
1148
1174
|
response,
|
|
1149
1175
|
request,
|
|
1150
|
-
|
|
1176
|
+
_build,
|
|
1151
1177
|
serverMode
|
|
1152
1178
|
);
|
|
1153
1179
|
}
|
|
1154
|
-
if (
|
|
1155
|
-
response = await
|
|
1180
|
+
if (_build.entry.module.handleDataRequest) {
|
|
1181
|
+
response = await _build.entry.module.handleDataRequest(response, {
|
|
1156
1182
|
context: loadContext,
|
|
1157
1183
|
params: singleFetchMatches ? singleFetchMatches[0].params : {},
|
|
1158
1184
|
request
|
|
@@ -1161,7 +1187,7 @@ function derive(build, mode) {
|
|
|
1161
1187
|
response = generateSingleFetchRedirectResponse(
|
|
1162
1188
|
response,
|
|
1163
1189
|
request,
|
|
1164
|
-
|
|
1190
|
+
_build,
|
|
1165
1191
|
serverMode
|
|
1166
1192
|
);
|
|
1167
1193
|
}
|
|
@@ -1169,7 +1195,7 @@ function derive(build, mode) {
|
|
|
1169
1195
|
} else if (!isSpaMode && matches && matches[matches.length - 1].route.module.default == null && matches[matches.length - 1].route.module.ErrorBoundary == null) {
|
|
1170
1196
|
response = await handleResourceRequest(
|
|
1171
1197
|
serverMode,
|
|
1172
|
-
|
|
1198
|
+
_build,
|
|
1173
1199
|
staticHandler,
|
|
1174
1200
|
matches.slice(-1)[0].route.id,
|
|
1175
1201
|
request,
|
|
@@ -1179,14 +1205,14 @@ function derive(build, mode) {
|
|
|
1179
1205
|
} else {
|
|
1180
1206
|
let { pathname } = url;
|
|
1181
1207
|
let criticalCss = void 0;
|
|
1182
|
-
if (
|
|
1183
|
-
criticalCss = await
|
|
1208
|
+
if (_build.unstable_getCriticalCss) {
|
|
1209
|
+
criticalCss = await _build.unstable_getCriticalCss({ pathname });
|
|
1184
1210
|
} else if (mode === "development" /* Development */ && getDevServerHooks()?.getCriticalCss) {
|
|
1185
1211
|
criticalCss = await getDevServerHooks()?.getCriticalCss?.(pathname);
|
|
1186
1212
|
}
|
|
1187
1213
|
response = await handleDocumentRequest(
|
|
1188
1214
|
serverMode,
|
|
1189
|
-
|
|
1215
|
+
_build,
|
|
1190
1216
|
staticHandler,
|
|
1191
1217
|
request,
|
|
1192
1218
|
loadContext,
|
|
@@ -1204,47 +1230,6 @@ function derive(build, mode) {
|
|
|
1204
1230
|
}
|
|
1205
1231
|
return response;
|
|
1206
1232
|
};
|
|
1207
|
-
if (build.entry.module.unstable_instrumentations) {
|
|
1208
|
-
requestHandler = instrumentHandler(
|
|
1209
|
-
requestHandler,
|
|
1210
|
-
build.entry.module.unstable_instrumentations.map((i) => i.handler).filter(Boolean)
|
|
1211
|
-
);
|
|
1212
|
-
}
|
|
1213
|
-
return {
|
|
1214
|
-
routes,
|
|
1215
|
-
dataRoutes,
|
|
1216
|
-
serverMode,
|
|
1217
|
-
staticHandler,
|
|
1218
|
-
errorHandler,
|
|
1219
|
-
requestHandler
|
|
1220
|
-
};
|
|
1221
|
-
}
|
|
1222
|
-
var createRequestHandler = (build, mode) => {
|
|
1223
|
-
let _build;
|
|
1224
|
-
let routes;
|
|
1225
|
-
let serverMode;
|
|
1226
|
-
let staticHandler;
|
|
1227
|
-
let errorHandler;
|
|
1228
|
-
let _requestHandler;
|
|
1229
|
-
return async function requestHandler(request, initialContext) {
|
|
1230
|
-
_build = typeof build === "function" ? await build() : build;
|
|
1231
|
-
if (typeof build === "function") {
|
|
1232
|
-
let derived = derive(_build, mode);
|
|
1233
|
-
routes = derived.routes;
|
|
1234
|
-
serverMode = derived.serverMode;
|
|
1235
|
-
staticHandler = derived.staticHandler;
|
|
1236
|
-
errorHandler = derived.errorHandler;
|
|
1237
|
-
_requestHandler = derived.requestHandler;
|
|
1238
|
-
} else if (!routes || !serverMode || !staticHandler || !errorHandler || !_requestHandler) {
|
|
1239
|
-
let derived = derive(_build, mode);
|
|
1240
|
-
routes = derived.routes;
|
|
1241
|
-
serverMode = derived.serverMode;
|
|
1242
|
-
staticHandler = derived.staticHandler;
|
|
1243
|
-
errorHandler = derived.errorHandler;
|
|
1244
|
-
_requestHandler = derived.requestHandler;
|
|
1245
|
-
}
|
|
1246
|
-
return _requestHandler(request, initialContext);
|
|
1247
|
-
};
|
|
1248
1233
|
};
|
|
1249
1234
|
async function handleManifestRequest(build, routes, url) {
|
|
1250
1235
|
if (build.assets.version !== url.searchParams.get("version")) {
|
|
@@ -1474,7 +1459,6 @@ async function handleResourceRequest(serverMode, build, staticHandler, routeId,
|
|
|
1474
1459
|
}
|
|
1475
1460
|
function handleQueryRouteError(error) {
|
|
1476
1461
|
if (isResponse(error)) {
|
|
1477
|
-
error.headers.set("X-Remix-Catch", "yes");
|
|
1478
1462
|
return error;
|
|
1479
1463
|
}
|
|
1480
1464
|
if (isRouteErrorResponse(error)) {
|
|
@@ -1501,10 +1485,7 @@ function errorResponseToJson(errorResponse, serverMode) {
|
|
|
1501
1485
|
),
|
|
1502
1486
|
{
|
|
1503
1487
|
status: errorResponse.status,
|
|
1504
|
-
statusText: errorResponse.statusText
|
|
1505
|
-
headers: {
|
|
1506
|
-
"X-Remix-Error": "yes"
|
|
1507
|
-
}
|
|
1488
|
+
statusText: errorResponse.statusText
|
|
1508
1489
|
}
|
|
1509
1490
|
);
|
|
1510
1491
|
}
|
|
@@ -1872,7 +1853,7 @@ function createCallServer({
|
|
|
1872
1853
|
return async (id, args) => {
|
|
1873
1854
|
let actionId = globalVar.__routerActionID = (globalVar.__routerActionID ?? (globalVar.__routerActionID = 0)) + 1;
|
|
1874
1855
|
const temporaryReferences = createTemporaryReferenceSet();
|
|
1875
|
-
const
|
|
1856
|
+
const payloadPromise = fetchImplementation(
|
|
1876
1857
|
new Request(location.href, {
|
|
1877
1858
|
body: await encodeReply(args, { temporaryReferences }),
|
|
1878
1859
|
method: "POST",
|
|
@@ -1881,44 +1862,45 @@ function createCallServer({
|
|
|
1881
1862
|
"rsc-action-id": id
|
|
1882
1863
|
}
|
|
1883
1864
|
})
|
|
1884
|
-
)
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
}
|
|
1888
|
-
const payload = await createFromReadableStream(response.body, {
|
|
1889
|
-
temporaryReferences
|
|
1890
|
-
});
|
|
1891
|
-
if (payload.type === "redirect") {
|
|
1892
|
-
if (payload.reload) {
|
|
1893
|
-
window.location.href = payload.location;
|
|
1894
|
-
return;
|
|
1865
|
+
).then((response) => {
|
|
1866
|
+
if (!response.body) {
|
|
1867
|
+
throw new Error("No response body");
|
|
1895
1868
|
}
|
|
1896
|
-
|
|
1897
|
-
|
|
1869
|
+
return createFromReadableStream(response.body, {
|
|
1870
|
+
temporaryReferences
|
|
1898
1871
|
});
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1872
|
+
});
|
|
1873
|
+
globalVar.__reactRouterDataRouter.__setPendingRerender(
|
|
1874
|
+
Promise.resolve(payloadPromise).then(async (payload) => {
|
|
1875
|
+
if (payload.type === "redirect") {
|
|
1876
|
+
if (payload.reload || isExternalLocation(payload.location)) {
|
|
1877
|
+
window.location.href = payload.location;
|
|
1878
|
+
return () => {
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
return () => {
|
|
1882
|
+
globalVar.__reactRouterDataRouter.navigate(payload.location, {
|
|
1883
|
+
replace: payload.replace
|
|
1884
|
+
});
|
|
1885
|
+
};
|
|
1886
|
+
}
|
|
1887
|
+
if (payload.type !== "action") {
|
|
1888
|
+
throw new Error("Unexpected payload type");
|
|
1889
|
+
}
|
|
1890
|
+
const rerender = await payload.rerender;
|
|
1891
|
+
if (rerender && landedActionId < actionId && globalVar.__routerActionID <= actionId) {
|
|
1892
|
+
if (rerender.type === "redirect") {
|
|
1893
|
+
if (rerender.reload || isExternalLocation(rerender.location)) {
|
|
1894
|
+
window.location.href = rerender.location;
|
|
1895
|
+
return;
|
|
1896
|
+
}
|
|
1897
|
+
return () => {
|
|
1917
1898
|
globalVar.__reactRouterDataRouter.navigate(rerender.location, {
|
|
1918
1899
|
replace: rerender.replace
|
|
1919
1900
|
});
|
|
1920
|
-
|
|
1921
|
-
|
|
1901
|
+
};
|
|
1902
|
+
}
|
|
1903
|
+
return () => {
|
|
1922
1904
|
let lastMatch;
|
|
1923
1905
|
for (const match of rerender.matches) {
|
|
1924
1906
|
globalVar.__reactRouterDataRouter.patchRoutes(
|
|
@@ -1929,29 +1911,32 @@ function createCallServer({
|
|
|
1929
1911
|
lastMatch = match;
|
|
1930
1912
|
}
|
|
1931
1913
|
window.__reactRouterDataRouter._internalSetStateDoNotUseOrYouWillBreakYourApp(
|
|
1932
|
-
{
|
|
1914
|
+
{
|
|
1915
|
+
loaderData: Object.assign(
|
|
1916
|
+
{},
|
|
1917
|
+
globalVar.__reactRouterDataRouter.state.loaderData,
|
|
1918
|
+
rerender.loaderData
|
|
1919
|
+
),
|
|
1920
|
+
errors: rerender.errors ? Object.assign(
|
|
1921
|
+
{},
|
|
1922
|
+
globalVar.__reactRouterDataRouter.state.errors,
|
|
1923
|
+
rerender.errors
|
|
1924
|
+
) : null
|
|
1925
|
+
}
|
|
1933
1926
|
);
|
|
1934
|
-
|
|
1935
|
-
window.__reactRouterDataRouter._internalSetStateDoNotUseOrYouWillBreakYourApp(
|
|
1936
|
-
{
|
|
1937
|
-
loaderData: Object.assign(
|
|
1938
|
-
{},
|
|
1939
|
-
globalVar.__reactRouterDataRouter.state.loaderData,
|
|
1940
|
-
rerender.loaderData
|
|
1941
|
-
),
|
|
1942
|
-
errors: rerender.errors ? Object.assign(
|
|
1943
|
-
{},
|
|
1944
|
-
globalVar.__reactRouterDataRouter.state.errors,
|
|
1945
|
-
rerender.errors
|
|
1946
|
-
) : null
|
|
1947
|
-
}
|
|
1948
|
-
);
|
|
1949
|
-
});
|
|
1950
|
-
}
|
|
1927
|
+
};
|
|
1951
1928
|
}
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1929
|
+
return () => {
|
|
1930
|
+
};
|
|
1931
|
+
}).catch(() => {
|
|
1932
|
+
})
|
|
1933
|
+
);
|
|
1934
|
+
return payloadPromise.then((payload) => {
|
|
1935
|
+
if (payload.type !== "action" && payload.type !== "redirect") {
|
|
1936
|
+
throw new Error("Unexpected payload type");
|
|
1937
|
+
}
|
|
1938
|
+
return payload.actionResult;
|
|
1939
|
+
});
|
|
1955
1940
|
};
|
|
1956
1941
|
}
|
|
1957
1942
|
function createRouterFromPayload({
|
|
@@ -2171,8 +2156,8 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
|
|
|
2171
2156
|
let res = await fetchImplementation(
|
|
2172
2157
|
new Request(url, await createRequestInit(request))
|
|
2173
2158
|
);
|
|
2174
|
-
if (res.status
|
|
2175
|
-
throw new ErrorResponseImpl(
|
|
2159
|
+
if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
|
|
2160
|
+
throw new ErrorResponseImpl(res.status, res.statusText, await res.text());
|
|
2176
2161
|
}
|
|
2177
2162
|
invariant(res.body, "No response body to decode");
|
|
2178
2163
|
try {
|
|
@@ -2318,7 +2303,7 @@ function RSCHydratedRouter({
|
|
|
2318
2303
|
routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" },
|
|
2319
2304
|
routeModules
|
|
2320
2305
|
};
|
|
2321
|
-
return /* @__PURE__ */ React4.createElement(RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React4.createElement(RSCRouterGlobalErrorBoundary, { location: location2 }, /* @__PURE__ */ React4.createElement(FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React4.createElement(
|
|
2306
|
+
return /* @__PURE__ */ React4.createElement(RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React4.createElement(RSCRouterGlobalErrorBoundary, { location: location2 }, /* @__PURE__ */ React4.createElement(FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React4.createElement(UNSTABLE_TransitionEnabledRouterProvider, { router, flushSync: ReactDOM.flushSync }))));
|
|
2322
2307
|
}
|
|
2323
2308
|
function createRouteFromServerManifest(match, payload) {
|
|
2324
2309
|
let hasInitialData = payload && match.id in payload.loaderData;
|
|
@@ -2475,6 +2460,10 @@ function debounce(callback, wait) {
|
|
|
2475
2460
|
timeoutId = window.setTimeout(() => callback(...args), wait);
|
|
2476
2461
|
};
|
|
2477
2462
|
}
|
|
2463
|
+
function isExternalLocation(location2) {
|
|
2464
|
+
const newLocation = new URL(location2, window.location.href);
|
|
2465
|
+
return newLocation.origin !== window.location.origin;
|
|
2466
|
+
}
|
|
2478
2467
|
|
|
2479
2468
|
// lib/rsc/server.ssr.tsx
|
|
2480
2469
|
import * as React5 from "react";
|
|
@@ -2660,7 +2649,7 @@ async function routeRSCServerRequest({
|
|
|
2660
2649
|
headers2.delete("Content-Encoding");
|
|
2661
2650
|
headers2.delete("Content-Length");
|
|
2662
2651
|
headers2.delete("Content-Type");
|
|
2663
|
-
headers2.delete("
|
|
2652
|
+
headers2.delete("X-Remix-Response");
|
|
2664
2653
|
headers2.set("Location", payload.location);
|
|
2665
2654
|
return new Response(serverResponseB?.body || "", {
|
|
2666
2655
|
headers: headers2,
|