react-router 0.0.0-experimental-e2130f538 → 0.0.0-experimental-73e447577
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 +0 -35
- package/dist/development/{chunk-KLLSQY3I.mjs → chunk-NKIXC2FA.mjs} +131 -116
- package/dist/development/{chunk-KNNCBCIS.mjs → chunk-PF7FO4KS.mjs} +310 -135
- package/dist/{production/chunk-D5G4H67X.js → development/chunk-SOMUQ5BV.js} +154 -265
- package/dist/development/{chunk-VU2GHDHY.js → chunk-WQE2SM7S.js} +349 -63
- package/dist/development/dom-export.d.mts +59 -4
- package/dist/development/dom-export.d.ts +59 -3
- package/dist/development/dom-export.js +8 -5
- package/dist/development/dom-export.mjs +8 -5
- package/dist/development/{index-react-server-client-DKvU8YRr.d.ts → index-react-server-client-83aVZHgI.d.ts} +198 -134
- package/dist/{production/index-react-server-client-2EDmGlsZ.d.mts → development/index-react-server-client-BDG19ZQl.d.mts} +140 -77
- package/dist/development/index-react-server-client.d.mts +3 -3
- package/dist/development/index-react-server-client.d.ts +3 -2
- 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 +106 -1
- package/dist/development/index-react-server.d.ts +106 -1
- package/dist/development/index-react-server.js +183 -14
- package/dist/development/index-react-server.mjs +183 -14
- package/dist/development/index.d.mts +10 -10
- package/dist/development/index.d.ts +10 -8
- package/dist/development/index.js +223 -208
- package/dist/development/index.mjs +3 -3
- package/dist/development/instrumentation-XYmrzhe3.d.ts +1138 -0
- package/dist/development/lib/types/internal.d.mts +2 -2
- package/dist/development/lib/types/internal.d.ts +2 -1
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{routeModules-BmVo7q9e.d.ts → routeModules-Bu1JamQV.d.ts} +73 -1046
- package/dist/development/{route-data-CDwqkzPE.d.mts → routeModules-CtCOLGtG.d.mts} +157 -147
- package/dist/development/{context-BqL5Eckq.d.mts → router-2BoB34m1.d.mts} +1403 -1250
- package/dist/{development/chunk-LMUBLF7X.js → production/chunk-TA3WUUL6.js} +154 -265
- package/dist/production/{chunk-KBACS3E4.mjs → chunk-TUGDEB6V.mjs} +131 -116
- package/dist/production/{chunk-4OVLJFUE.js → chunk-VRFRIIGI.js} +349 -63
- package/dist/production/{chunk-PXZXGDXW.mjs → chunk-YUNRQEIK.mjs} +310 -135
- package/dist/production/dom-export.d.mts +59 -4
- package/dist/production/dom-export.d.ts +59 -3
- package/dist/production/dom-export.js +8 -5
- package/dist/production/dom-export.mjs +8 -5
- package/dist/{development/index-react-server-client-2EDmGlsZ.d.mts → production/index-react-server-client-83aVZHgI.d.ts} +140 -77
- package/dist/production/{index-react-server-client-DKvU8YRr.d.ts → index-react-server-client-BDG19ZQl.d.mts} +198 -134
- package/dist/production/index-react-server-client.d.mts +3 -3
- package/dist/production/index-react-server-client.d.ts +3 -2
- 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 +106 -1
- package/dist/production/index-react-server.d.ts +106 -1
- package/dist/production/index-react-server.js +183 -14
- package/dist/production/index-react-server.mjs +183 -14
- package/dist/production/index.d.mts +10 -10
- package/dist/production/index.d.ts +10 -8
- package/dist/production/index.js +223 -208
- package/dist/production/index.mjs +3 -3
- package/dist/production/instrumentation-XYmrzhe3.d.ts +1138 -0
- package/dist/production/lib/types/internal.d.mts +2 -2
- package/dist/production/lib/types/internal.d.ts +2 -1
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{routeModules-BmVo7q9e.d.ts → routeModules-Bu1JamQV.d.ts} +73 -1046
- package/dist/production/{route-data-CDwqkzPE.d.mts → routeModules-CtCOLGtG.d.mts} +157 -147
- package/dist/production/{context-BqL5Eckq.d.mts → router-2BoB34m1.d.mts} +1403 -1250
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,40 +1,5 @@
|
|
|
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
|
-
|
|
38
3
|
## 7.9.1
|
|
39
4
|
|
|
40
5
|
### Patch Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-73e447577
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -22,7 +22,6 @@ import {
|
|
|
22
22
|
SingleFetchRedirectSymbol,
|
|
23
23
|
StaticRouterProvider,
|
|
24
24
|
StreamTransfer,
|
|
25
|
-
UNSTABLE_TransitionEnabledRouterProvider,
|
|
26
25
|
convertRoutesToDataRoutes,
|
|
27
26
|
createBrowserHistory,
|
|
28
27
|
createContext,
|
|
@@ -38,6 +37,7 @@ import {
|
|
|
38
37
|
getManifestPath,
|
|
39
38
|
getSingleFetchDataStrategyImpl,
|
|
40
39
|
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-PF7FO4KS.mjs";
|
|
64
64
|
|
|
65
65
|
// lib/dom/ssr/server.tsx
|
|
66
66
|
import * as React from "react";
|
|
@@ -517,7 +517,8 @@ 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
|
|
520
|
+
context: args.context,
|
|
521
|
+
pattern: args.pattern
|
|
521
522
|
});
|
|
522
523
|
if (isDataWithResponseInit(result) && result.init && result.init.status && isRedirectStatusCode(result.init.status)) {
|
|
523
524
|
throw new Response(null, result.init);
|
|
@@ -1010,7 +1011,8 @@ function derive(build, mode) {
|
|
|
1010
1011
|
let dataRoutes = createStaticHandlerDataRoutes(build.routes, build.future);
|
|
1011
1012
|
let serverMode = isServerMode(mode) ? mode : "production" /* Production */;
|
|
1012
1013
|
let staticHandler = createStaticHandler(dataRoutes, {
|
|
1013
|
-
basename: build.basename
|
|
1014
|
+
basename: build.basename,
|
|
1015
|
+
unstable_instrumentations: build.entry.module.unstable_instrumentations
|
|
1014
1016
|
});
|
|
1015
1017
|
let errorHandler = build.entry.module.handleError || ((error, { request }) => {
|
|
1016
1018
|
if (serverMode !== "test" /* Test */ && !request.signal.aborted) {
|
|
@@ -1020,35 +1022,7 @@ function derive(build, mode) {
|
|
|
1020
1022
|
);
|
|
1021
1023
|
}
|
|
1022
1024
|
});
|
|
1023
|
-
|
|
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
|
-
}
|
|
1025
|
+
let requestHandler = async (request, initialContext) => {
|
|
1052
1026
|
let params = {};
|
|
1053
1027
|
let loadContext;
|
|
1054
1028
|
let handleError = (error) => {
|
|
@@ -1061,7 +1035,7 @@ var createRequestHandler = (build, mode) => {
|
|
|
1061
1035
|
request
|
|
1062
1036
|
});
|
|
1063
1037
|
};
|
|
1064
|
-
if (
|
|
1038
|
+
if (build.future.v8_middleware) {
|
|
1065
1039
|
if (initialContext && !(initialContext instanceof RouterContextProvider)) {
|
|
1066
1040
|
let error = new Error(
|
|
1067
1041
|
"Invalid `context` value provided to `handleRequest`. When middleware is enabled you must return an instance of `RouterContextProvider` from your `getLoadContext` function."
|
|
@@ -1074,7 +1048,7 @@ var createRequestHandler = (build, mode) => {
|
|
|
1074
1048
|
loadContext = initialContext || {};
|
|
1075
1049
|
}
|
|
1076
1050
|
let url = new URL(request.url);
|
|
1077
|
-
let normalizedBasename =
|
|
1051
|
+
let normalizedBasename = build.basename || "/";
|
|
1078
1052
|
let normalizedPath = url.pathname;
|
|
1079
1053
|
if (stripBasename(normalizedPath, normalizedBasename) === "/_root.data") {
|
|
1080
1054
|
normalizedPath = normalizedBasename;
|
|
@@ -1085,7 +1059,7 @@ var createRequestHandler = (build, mode) => {
|
|
|
1085
1059
|
normalizedPath = normalizedPath.slice(0, -1);
|
|
1086
1060
|
}
|
|
1087
1061
|
let isSpaMode = getBuildTimeHeader(request, "X-React-Router-SPA-Mode") === "yes";
|
|
1088
|
-
if (!
|
|
1062
|
+
if (!build.ssr) {
|
|
1089
1063
|
let decodedPath = decodeURI(normalizedPath);
|
|
1090
1064
|
if (normalizedBasename !== "/") {
|
|
1091
1065
|
let strippedPath = stripBasename(decodedPath, normalizedBasename);
|
|
@@ -1109,9 +1083,9 @@ var createRequestHandler = (build, mode) => {
|
|
|
1109
1083
|
}
|
|
1110
1084
|
decodedPath = strippedPath;
|
|
1111
1085
|
}
|
|
1112
|
-
if (
|
|
1086
|
+
if (build.prerender.length === 0) {
|
|
1113
1087
|
isSpaMode = true;
|
|
1114
|
-
} else if (!
|
|
1088
|
+
} else if (!build.prerender.includes(decodedPath) && !build.prerender.includes(decodedPath + "/")) {
|
|
1115
1089
|
if (url.pathname.endsWith(".data")) {
|
|
1116
1090
|
errorHandler(
|
|
1117
1091
|
new ErrorResponseImpl(
|
|
@@ -1135,19 +1109,19 @@ var createRequestHandler = (build, mode) => {
|
|
|
1135
1109
|
}
|
|
1136
1110
|
}
|
|
1137
1111
|
let manifestUrl = getManifestPath(
|
|
1138
|
-
|
|
1112
|
+
build.routeDiscovery.manifestPath,
|
|
1139
1113
|
normalizedBasename
|
|
1140
1114
|
);
|
|
1141
1115
|
if (url.pathname === manifestUrl) {
|
|
1142
1116
|
try {
|
|
1143
|
-
let res = await handleManifestRequest(
|
|
1117
|
+
let res = await handleManifestRequest(build, routes, url);
|
|
1144
1118
|
return res;
|
|
1145
1119
|
} catch (e) {
|
|
1146
1120
|
handleError(e);
|
|
1147
1121
|
return new Response("Unknown Server Error", { status: 500 });
|
|
1148
1122
|
}
|
|
1149
1123
|
}
|
|
1150
|
-
let matches = matchServerRoutes(routes, normalizedPath,
|
|
1124
|
+
let matches = matchServerRoutes(routes, normalizedPath, build.basename);
|
|
1151
1125
|
if (matches && matches.length > 0) {
|
|
1152
1126
|
Object.assign(params, matches[0].params);
|
|
1153
1127
|
}
|
|
@@ -1158,11 +1132,11 @@ var createRequestHandler = (build, mode) => {
|
|
|
1158
1132
|
let singleFetchMatches = matchServerRoutes(
|
|
1159
1133
|
routes,
|
|
1160
1134
|
handlerUrl.pathname,
|
|
1161
|
-
|
|
1135
|
+
build.basename
|
|
1162
1136
|
);
|
|
1163
1137
|
response = await handleSingleFetchRequest(
|
|
1164
1138
|
serverMode,
|
|
1165
|
-
|
|
1139
|
+
build,
|
|
1166
1140
|
staticHandler,
|
|
1167
1141
|
request,
|
|
1168
1142
|
handlerUrl,
|
|
@@ -1173,12 +1147,12 @@ var createRequestHandler = (build, mode) => {
|
|
|
1173
1147
|
response = generateSingleFetchRedirectResponse(
|
|
1174
1148
|
response,
|
|
1175
1149
|
request,
|
|
1176
|
-
|
|
1150
|
+
build,
|
|
1177
1151
|
serverMode
|
|
1178
1152
|
);
|
|
1179
1153
|
}
|
|
1180
|
-
if (
|
|
1181
|
-
response = await
|
|
1154
|
+
if (build.entry.module.handleDataRequest) {
|
|
1155
|
+
response = await build.entry.module.handleDataRequest(response, {
|
|
1182
1156
|
context: loadContext,
|
|
1183
1157
|
params: singleFetchMatches ? singleFetchMatches[0].params : {},
|
|
1184
1158
|
request
|
|
@@ -1187,7 +1161,7 @@ var createRequestHandler = (build, mode) => {
|
|
|
1187
1161
|
response = generateSingleFetchRedirectResponse(
|
|
1188
1162
|
response,
|
|
1189
1163
|
request,
|
|
1190
|
-
|
|
1164
|
+
build,
|
|
1191
1165
|
serverMode
|
|
1192
1166
|
);
|
|
1193
1167
|
}
|
|
@@ -1195,7 +1169,7 @@ var createRequestHandler = (build, mode) => {
|
|
|
1195
1169
|
} else if (!isSpaMode && matches && matches[matches.length - 1].route.module.default == null && matches[matches.length - 1].route.module.ErrorBoundary == null) {
|
|
1196
1170
|
response = await handleResourceRequest(
|
|
1197
1171
|
serverMode,
|
|
1198
|
-
|
|
1172
|
+
build,
|
|
1199
1173
|
staticHandler,
|
|
1200
1174
|
matches.slice(-1)[0].route.id,
|
|
1201
1175
|
request,
|
|
@@ -1205,14 +1179,14 @@ var createRequestHandler = (build, mode) => {
|
|
|
1205
1179
|
} else {
|
|
1206
1180
|
let { pathname } = url;
|
|
1207
1181
|
let criticalCss = void 0;
|
|
1208
|
-
if (
|
|
1209
|
-
criticalCss = await
|
|
1182
|
+
if (build.unstable_getCriticalCss) {
|
|
1183
|
+
criticalCss = await build.unstable_getCriticalCss({ pathname });
|
|
1210
1184
|
} else if (mode === "development" /* Development */ && getDevServerHooks()?.getCriticalCss) {
|
|
1211
1185
|
criticalCss = await getDevServerHooks()?.getCriticalCss?.(pathname);
|
|
1212
1186
|
}
|
|
1213
1187
|
response = await handleDocumentRequest(
|
|
1214
1188
|
serverMode,
|
|
1215
|
-
|
|
1189
|
+
build,
|
|
1216
1190
|
staticHandler,
|
|
1217
1191
|
request,
|
|
1218
1192
|
loadContext,
|
|
@@ -1230,6 +1204,47 @@ var createRequestHandler = (build, mode) => {
|
|
|
1230
1204
|
}
|
|
1231
1205
|
return response;
|
|
1232
1206
|
};
|
|
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
|
+
};
|
|
1233
1248
|
};
|
|
1234
1249
|
async function handleManifestRequest(build, routes, url) {
|
|
1235
1250
|
if (build.assets.version !== url.searchParams.get("version")) {
|
|
@@ -1459,6 +1474,7 @@ async function handleResourceRequest(serverMode, build, staticHandler, routeId,
|
|
|
1459
1474
|
}
|
|
1460
1475
|
function handleQueryRouteError(error) {
|
|
1461
1476
|
if (isResponse(error)) {
|
|
1477
|
+
error.headers.set("X-Remix-Catch", "yes");
|
|
1462
1478
|
return error;
|
|
1463
1479
|
}
|
|
1464
1480
|
if (isRouteErrorResponse(error)) {
|
|
@@ -1485,7 +1501,10 @@ function errorResponseToJson(errorResponse, serverMode) {
|
|
|
1485
1501
|
),
|
|
1486
1502
|
{
|
|
1487
1503
|
status: errorResponse.status,
|
|
1488
|
-
statusText: errorResponse.statusText
|
|
1504
|
+
statusText: errorResponse.statusText,
|
|
1505
|
+
headers: {
|
|
1506
|
+
"X-Remix-Error": "yes"
|
|
1507
|
+
}
|
|
1489
1508
|
}
|
|
1490
1509
|
);
|
|
1491
1510
|
}
|
|
@@ -1853,7 +1872,7 @@ function createCallServer({
|
|
|
1853
1872
|
return async (id, args) => {
|
|
1854
1873
|
let actionId = globalVar.__routerActionID = (globalVar.__routerActionID ?? (globalVar.__routerActionID = 0)) + 1;
|
|
1855
1874
|
const temporaryReferences = createTemporaryReferenceSet();
|
|
1856
|
-
const
|
|
1875
|
+
const response = await fetchImplementation(
|
|
1857
1876
|
new Request(location.href, {
|
|
1858
1877
|
body: await encodeReply(args, { temporaryReferences }),
|
|
1859
1878
|
method: "POST",
|
|
@@ -1862,45 +1881,44 @@ function createCallServer({
|
|
|
1862
1881
|
"rsc-action-id": id
|
|
1863
1882
|
}
|
|
1864
1883
|
})
|
|
1865
|
-
)
|
|
1866
|
-
|
|
1867
|
-
|
|
1884
|
+
);
|
|
1885
|
+
if (!response.body) {
|
|
1886
|
+
throw new Error("No response body");
|
|
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;
|
|
1868
1895
|
}
|
|
1869
|
-
|
|
1870
|
-
|
|
1896
|
+
globalVar.__reactRouterDataRouter.navigate(payload.location, {
|
|
1897
|
+
replace: payload.replace
|
|
1871
1898
|
});
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
const rerender = await payload.rerender;
|
|
1891
|
-
if (rerender && landedActionId < actionId && globalVar.__routerActionID <= actionId) {
|
|
1892
|
-
if (rerender.type === "redirect") {
|
|
1893
|
-
if (rerender.reload) {
|
|
1894
|
-
window.location.href = rerender.location;
|
|
1895
|
-
return;
|
|
1896
|
-
}
|
|
1897
|
-
return () => {
|
|
1899
|
+
return payload.actionResult;
|
|
1900
|
+
}
|
|
1901
|
+
if (payload.type !== "action") {
|
|
1902
|
+
throw new Error("Unexpected payload type");
|
|
1903
|
+
}
|
|
1904
|
+
if (payload.rerender) {
|
|
1905
|
+
React4.startTransition(
|
|
1906
|
+
// @ts-expect-error - We have old react types that don't know this can be async
|
|
1907
|
+
async () => {
|
|
1908
|
+
const rerender = await payload.rerender;
|
|
1909
|
+
if (!rerender) return;
|
|
1910
|
+
if (landedActionId < actionId && globalVar.__routerActionID <= actionId) {
|
|
1911
|
+
landedActionId = actionId;
|
|
1912
|
+
if (rerender.type === "redirect") {
|
|
1913
|
+
if (rerender.reload) {
|
|
1914
|
+
window.location.href = rerender.location;
|
|
1915
|
+
return;
|
|
1916
|
+
}
|
|
1898
1917
|
globalVar.__reactRouterDataRouter.navigate(rerender.location, {
|
|
1899
1918
|
replace: rerender.replace
|
|
1900
1919
|
});
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
return () => {
|
|
1920
|
+
return;
|
|
1921
|
+
}
|
|
1904
1922
|
let lastMatch;
|
|
1905
1923
|
for (const match of rerender.matches) {
|
|
1906
1924
|
globalVar.__reactRouterDataRouter.patchRoutes(
|
|
@@ -1911,32 +1929,29 @@ function createCallServer({
|
|
|
1911
1929
|
lastMatch = match;
|
|
1912
1930
|
}
|
|
1913
1931
|
window.__reactRouterDataRouter._internalSetStateDoNotUseOrYouWillBreakYourApp(
|
|
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
|
-
}
|
|
1932
|
+
{}
|
|
1926
1933
|
);
|
|
1927
|
-
|
|
1934
|
+
React4.startTransition(() => {
|
|
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
|
+
}
|
|
1928
1951
|
}
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
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
|
-
});
|
|
1952
|
+
);
|
|
1953
|
+
}
|
|
1954
|
+
return payload.actionResult;
|
|
1940
1955
|
};
|
|
1941
1956
|
}
|
|
1942
1957
|
function createRouterFromPayload({
|
|
@@ -2156,8 +2171,8 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
|
|
|
2156
2171
|
let res = await fetchImplementation(
|
|
2157
2172
|
new Request(url, await createRequestInit(request))
|
|
2158
2173
|
);
|
|
2159
|
-
if (res.status
|
|
2160
|
-
throw new ErrorResponseImpl(
|
|
2174
|
+
if (res.status === 404 && !res.headers.has("X-Remix-Response")) {
|
|
2175
|
+
throw new ErrorResponseImpl(404, "Not Found", true);
|
|
2161
2176
|
}
|
|
2162
2177
|
invariant(res.body, "No response body to decode");
|
|
2163
2178
|
try {
|
|
@@ -2303,7 +2318,7 @@ function RSCHydratedRouter({
|
|
|
2303
2318
|
routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" },
|
|
2304
2319
|
routeModules
|
|
2305
2320
|
};
|
|
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(
|
|
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(RouterProvider, { router, flushSync: ReactDOM.flushSync }))));
|
|
2307
2322
|
}
|
|
2308
2323
|
function createRouteFromServerManifest(match, payload) {
|
|
2309
2324
|
let hasInitialData = payload && match.id in payload.loaderData;
|
|
@@ -2645,7 +2660,7 @@ async function routeRSCServerRequest({
|
|
|
2645
2660
|
headers2.delete("Content-Encoding");
|
|
2646
2661
|
headers2.delete("Content-Length");
|
|
2647
2662
|
headers2.delete("Content-Type");
|
|
2648
|
-
headers2.delete("
|
|
2663
|
+
headers2.delete("x-remix-response");
|
|
2649
2664
|
headers2.set("Location", payload.location);
|
|
2650
2665
|
return new Response(serverResponseB?.body || "", {
|
|
2651
2666
|
headers: headers2,
|