react-router 7.9.1 → 7.9.2-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -9
- package/dist/development/{chunk-PW3F6ATG.js → chunk-ED2JHW2I.js} +102 -70
- package/dist/development/{chunk-B7RQU5TL.mjs → chunk-EPSRV6KC.mjs} +64 -26
- package/dist/{production/chunk-RCAZODXZ.mjs → development/chunk-PVJ3J6E6.mjs} +94 -9
- package/dist/{production/chunk-3SXVZXGI.js → development/chunk-VM65TX2A.js} +138 -132
- package/dist/development/{context-CIdFp11b.d.mts → context-BqL5Eckq.d.mts} +20 -0
- package/dist/development/dom-export.d.mts +1 -1
- package/dist/development/dom-export.js +3 -3
- package/dist/development/dom-export.mjs +3 -3
- package/dist/development/{index-react-server-client-BeVfPpWg.d.mts → index-react-server-client-2EDmGlsZ.d.mts} +40 -24
- package/dist/{production/index-react-server-client-BYr9g50r.d.ts → development/index-react-server-client-DKvU8YRr.d.ts} +39 -23
- package/dist/development/index-react-server-client.d.mts +3 -3
- package/dist/development/index-react-server-client.d.ts +2 -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 +10 -0
- package/dist/development/index-react-server.d.ts +10 -0
- package/dist/development/index-react-server.js +3 -3
- package/dist/development/index-react-server.mjs +3 -3
- package/dist/development/index.d.mts +16 -12
- package/dist/development/index.d.ts +14 -10
- package/dist/development/index.js +190 -105
- package/dist/development/index.mjs +3 -3
- package/dist/development/lib/types/internal.d.mts +2 -2
- package/dist/development/lib/types/internal.d.ts +1 -1
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{route-data-Bpm4liR_.d.mts → route-data-CDwqkzPE.d.mts} +1 -1
- package/dist/{production/routeModules-DnUHijGz.d.ts → development/routeModules-BmVo7q9e.d.ts} +20 -0
- package/dist/production/{chunk-HMYSPRGR.js → chunk-22I2H6CR.js} +102 -70
- package/dist/production/{chunk-P25HWPOZ.mjs → chunk-662O2YDJ.mjs} +64 -26
- package/dist/{development/chunk-SKNKB5VI.mjs → production/chunk-HAV7J4RO.mjs} +94 -9
- package/dist/{development/chunk-LWNHKVDL.js → production/chunk-K4BWIVAI.js} +138 -132
- package/dist/production/{context-CIdFp11b.d.mts → context-BqL5Eckq.d.mts} +20 -0
- package/dist/production/dom-export.d.mts +1 -1
- package/dist/production/dom-export.js +3 -3
- package/dist/production/dom-export.mjs +3 -3
- package/dist/production/{index-react-server-client-BeVfPpWg.d.mts → index-react-server-client-2EDmGlsZ.d.mts} +40 -24
- package/dist/{development/index-react-server-client-BYr9g50r.d.ts → production/index-react-server-client-DKvU8YRr.d.ts} +39 -23
- package/dist/production/index-react-server-client.d.mts +3 -3
- package/dist/production/index-react-server-client.d.ts +2 -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 +10 -0
- package/dist/production/index-react-server.d.ts +10 -0
- package/dist/production/index-react-server.js +3 -3
- package/dist/production/index-react-server.mjs +3 -3
- package/dist/production/index.d.mts +16 -12
- package/dist/production/index.d.ts +14 -10
- package/dist/production/index.js +190 -105
- package/dist/production/index.mjs +3 -3
- package/dist/production/lib/types/internal.d.mts +2 -2
- package/dist/production/lib/types/internal.d.ts +1 -1
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{route-data-Bpm4liR_.d.mts → route-data-CDwqkzPE.d.mts} +1 -1
- package/dist/{development/routeModules-DnUHijGz.d.ts → production/routeModules-BmVo7q9e.d.ts} +20 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.9.
|
|
2
|
+
* react-router v7.9.2-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -1054,7 +1054,7 @@ function createRouter(init) {
|
|
|
1054
1054
|
}
|
|
1055
1055
|
} else if (initialMatches.some((m) => m.route.lazy)) {
|
|
1056
1056
|
initialized = false;
|
|
1057
|
-
} else if (!initialMatches.some((m) => m.route
|
|
1057
|
+
} else if (!initialMatches.some((m) => routeHasLoaderOrMiddleware(m.route))) {
|
|
1058
1058
|
initialized = true;
|
|
1059
1059
|
} else {
|
|
1060
1060
|
let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;
|
|
@@ -1756,7 +1756,9 @@ function createRouter(init) {
|
|
|
1756
1756
|
pendingActionResult
|
|
1757
1757
|
);
|
|
1758
1758
|
pendingNavigationLoadId = ++incrementingLoadId;
|
|
1759
|
-
if (!init.dataStrategy && !dsMatches.some((m) => m.shouldLoad) && !dsMatches.some(
|
|
1759
|
+
if (!init.dataStrategy && !dsMatches.some((m) => m.shouldLoad) && !dsMatches.some(
|
|
1760
|
+
(m) => m.route.middleware && m.route.middleware.length > 0
|
|
1761
|
+
) && revalidatingFetchers.length === 0) {
|
|
1760
1762
|
let updatedFetchers2 = markFetchRedirectsDone();
|
|
1761
1763
|
completeNavigation(
|
|
1762
1764
|
location,
|
|
@@ -2437,6 +2439,10 @@ function createRouter(init) {
|
|
|
2437
2439
|
}
|
|
2438
2440
|
return state.fetchers.get(key) || IDLE_FETCHER;
|
|
2439
2441
|
}
|
|
2442
|
+
function resetFetcher(key, opts) {
|
|
2443
|
+
abortFetcher(key, opts?.reason);
|
|
2444
|
+
updateFetcherState(key, getDoneFetcher(null));
|
|
2445
|
+
}
|
|
2440
2446
|
function deleteFetcher(key) {
|
|
2441
2447
|
let fetcher = state.fetchers.get(key);
|
|
2442
2448
|
if (fetchControllers.has(key) && !(fetcher && fetcher.state === "loading" && fetchReloadIds.has(key))) {
|
|
@@ -2459,10 +2465,10 @@ function createRouter(init) {
|
|
|
2459
2465
|
}
|
|
2460
2466
|
updateState({ fetchers: new Map(state.fetchers) });
|
|
2461
2467
|
}
|
|
2462
|
-
function abortFetcher(key) {
|
|
2468
|
+
function abortFetcher(key, reason) {
|
|
2463
2469
|
let controller = fetchControllers.get(key);
|
|
2464
2470
|
if (controller) {
|
|
2465
|
-
controller.abort();
|
|
2471
|
+
controller.abort(reason);
|
|
2466
2472
|
fetchControllers.delete(key);
|
|
2467
2473
|
}
|
|
2468
2474
|
}
|
|
@@ -2726,6 +2732,7 @@ function createRouter(init) {
|
|
|
2726
2732
|
createHref: (to) => init.history.createHref(to),
|
|
2727
2733
|
encodeLocation: (to) => init.history.encodeLocation(to),
|
|
2728
2734
|
getFetcher,
|
|
2735
|
+
resetFetcher,
|
|
2729
2736
|
deleteFetcher: queueFetcherForDeletion,
|
|
2730
2737
|
dispose,
|
|
2731
2738
|
getBlocker,
|
|
@@ -3541,7 +3548,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
|
|
|
3541
3548
|
forceShouldLoad = false;
|
|
3542
3549
|
} else if (route.lazy) {
|
|
3543
3550
|
forceShouldLoad = true;
|
|
3544
|
-
} else if (route
|
|
3551
|
+
} else if (!routeHasLoaderOrMiddleware(route)) {
|
|
3545
3552
|
forceShouldLoad = false;
|
|
3546
3553
|
} else if (initialHydration) {
|
|
3547
3554
|
forceShouldLoad = shouldLoadRouteOnHydration(
|
|
@@ -3673,11 +3680,14 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
|
|
|
3673
3680
|
});
|
|
3674
3681
|
return { dsMatches, revalidatingFetchers };
|
|
3675
3682
|
}
|
|
3683
|
+
function routeHasLoaderOrMiddleware(route) {
|
|
3684
|
+
return route.loader != null || route.middleware != null && route.middleware.length > 0;
|
|
3685
|
+
}
|
|
3676
3686
|
function shouldLoadRouteOnHydration(route, loaderData, errors) {
|
|
3677
3687
|
if (route.lazy) {
|
|
3678
3688
|
return true;
|
|
3679
3689
|
}
|
|
3680
|
-
if (!route
|
|
3690
|
+
if (!routeHasLoaderOrMiddleware(route)) {
|
|
3681
3691
|
return false;
|
|
3682
3692
|
}
|
|
3683
3693
|
let hasData = loaderData != null && route.id in loaderData;
|
|
@@ -4006,9 +4016,15 @@ function runClientMiddlewarePipeline(args, handler) {
|
|
|
4006
4016
|
let { matches } = args;
|
|
4007
4017
|
let maxBoundaryIdx = Math.min(
|
|
4008
4018
|
// Throwing route
|
|
4009
|
-
|
|
4019
|
+
Math.max(
|
|
4020
|
+
matches.findIndex((m) => m.route.id === routeId),
|
|
4021
|
+
0
|
|
4022
|
+
),
|
|
4010
4023
|
// or the shallowest route that needs to load data
|
|
4011
|
-
|
|
4024
|
+
Math.max(
|
|
4025
|
+
matches.findIndex((m) => m.unstable_shouldCallHandler()),
|
|
4026
|
+
0
|
|
4027
|
+
)
|
|
4012
4028
|
);
|
|
4013
4029
|
let boundaryRouteId = findNearestBoundary(
|
|
4014
4030
|
matches,
|
|
@@ -5056,10 +5072,10 @@ function useOutletContext() {
|
|
|
5056
5072
|
}
|
|
5057
5073
|
function useOutlet(context) {
|
|
5058
5074
|
let outlet = React2.useContext(RouteContext).outlet;
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5075
|
+
return React2.useMemo(
|
|
5076
|
+
() => outlet && /* @__PURE__ */ React2.createElement(OutletContext.Provider, { value: context }, outlet),
|
|
5077
|
+
[outlet, context]
|
|
5078
|
+
);
|
|
5063
5079
|
}
|
|
5064
5080
|
function useParams() {
|
|
5065
5081
|
let { matches } = React2.useContext(RouteContext);
|
|
@@ -5143,13 +5159,23 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
5143
5159
|
params: Object.assign({}, parentParams, match.params),
|
|
5144
5160
|
pathname: joinPaths([
|
|
5145
5161
|
parentPathnameBase,
|
|
5146
|
-
// Re-encode pathnames that were decoded inside matchRoutes
|
|
5147
|
-
|
|
5162
|
+
// Re-encode pathnames that were decoded inside matchRoutes.
|
|
5163
|
+
// Pre-encode `?` and `#` ahead of `encodeLocation` because it uses
|
|
5164
|
+
// `new URL()` internally and we need to prevent it from treating
|
|
5165
|
+
// them as separators
|
|
5166
|
+
navigator.encodeLocation ? navigator.encodeLocation(
|
|
5167
|
+
match.pathname.replace(/\?/g, "%3F").replace(/#/g, "%23")
|
|
5168
|
+
).pathname : match.pathname
|
|
5148
5169
|
]),
|
|
5149
5170
|
pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([
|
|
5150
5171
|
parentPathnameBase,
|
|
5151
5172
|
// Re-encode pathnames that were decoded inside matchRoutes
|
|
5152
|
-
|
|
5173
|
+
// Pre-encode `?` and `#` ahead of `encodeLocation` because it uses
|
|
5174
|
+
// `new URL()` internally and we need to prevent it from treating
|
|
5175
|
+
// them as separators
|
|
5176
|
+
navigator.encodeLocation ? navigator.encodeLocation(
|
|
5177
|
+
match.pathnameBase.replace(/\?/g, "%3F").replace(/#/g, "%23")
|
|
5178
|
+
).pathname : match.pathnameBase
|
|
5153
5179
|
])
|
|
5154
5180
|
})
|
|
5155
5181
|
),
|
|
@@ -6083,6 +6109,7 @@ function createRoutesFromChildren(children, parentPath = []) {
|
|
|
6083
6109
|
Component: element.props.Component,
|
|
6084
6110
|
index: element.props.index,
|
|
6085
6111
|
path: element.props.path,
|
|
6112
|
+
middleware: element.props.middleware,
|
|
6086
6113
|
loader: element.props.loader,
|
|
6087
6114
|
action: element.props.action,
|
|
6088
6115
|
hydrateFallbackElement: element.props.hydrateFallbackElement,
|
|
@@ -8262,7 +8289,7 @@ function getManifestPath(_manifestPath, basename) {
|
|
|
8262
8289
|
var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
|
|
8263
8290
|
async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, manifestPath, patchRoutes, signal) {
|
|
8264
8291
|
const searchParams = new URLSearchParams();
|
|
8265
|
-
paths.sort().
|
|
8292
|
+
searchParams.set("paths", paths.sort().join(","));
|
|
8266
8293
|
searchParams.set("version", manifest.version);
|
|
8267
8294
|
let url = new URL(
|
|
8268
8295
|
getManifestPath(manifestPath, basename),
|
|
@@ -8285,13 +8312,16 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
|
|
|
8285
8312
|
);
|
|
8286
8313
|
return;
|
|
8287
8314
|
}
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
|
|
8292
|
-
|
|
8315
|
+
try {
|
|
8316
|
+
if (sessionStorage.getItem(MANIFEST_VERSION_STORAGE_KEY) === manifest.version) {
|
|
8317
|
+
console.error(
|
|
8318
|
+
"Unable to discover routes due to manifest version mismatch."
|
|
8319
|
+
);
|
|
8320
|
+
return;
|
|
8321
|
+
}
|
|
8322
|
+
sessionStorage.setItem(MANIFEST_VERSION_STORAGE_KEY, manifest.version);
|
|
8323
|
+
} catch {
|
|
8293
8324
|
}
|
|
8294
|
-
sessionStorage.setItem(MANIFEST_VERSION_STORAGE_KEY, manifest.version);
|
|
8295
8325
|
window.location.href = errorReloadPath;
|
|
8296
8326
|
console.warn("Detected manifest version mismatch, reloading...");
|
|
8297
8327
|
await new Promise(() => {
|
|
@@ -8299,7 +8329,10 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
|
|
|
8299
8329
|
} else if (res.status >= 400) {
|
|
8300
8330
|
throw new Error(await res.text());
|
|
8301
8331
|
}
|
|
8302
|
-
|
|
8332
|
+
try {
|
|
8333
|
+
sessionStorage.removeItem(MANIFEST_VERSION_STORAGE_KEY);
|
|
8334
|
+
} catch {
|
|
8335
|
+
}
|
|
8303
8336
|
serverPatches = await res.json();
|
|
8304
8337
|
} catch (e) {
|
|
8305
8338
|
if (signal?.aborted) return;
|
|
@@ -8964,7 +8997,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
8964
8997
|
try {
|
|
8965
8998
|
if (isBrowser) {
|
|
8966
8999
|
window.__reactRouterVersion = // @ts-expect-error
|
|
8967
|
-
"7.9.
|
|
9000
|
+
"7.9.2-pre.0";
|
|
8968
9001
|
}
|
|
8969
9002
|
} catch (e) {
|
|
8970
9003
|
}
|
|
@@ -9578,6 +9611,7 @@ function useFetcher({
|
|
|
9578
9611
|
},
|
|
9579
9612
|
[fetcherKey, submitImpl]
|
|
9580
9613
|
);
|
|
9614
|
+
let unstable_reset = React10.useCallback((opts) => router.resetFetcher(fetcherKey, opts), [router, fetcherKey]);
|
|
9581
9615
|
let FetcherForm = React10.useMemo(() => {
|
|
9582
9616
|
let FetcherForm2 = React10.forwardRef(
|
|
9583
9617
|
(props, ref) => {
|
|
@@ -9594,10 +9628,11 @@ function useFetcher({
|
|
|
9594
9628
|
Form: FetcherForm,
|
|
9595
9629
|
submit,
|
|
9596
9630
|
load,
|
|
9631
|
+
unstable_reset,
|
|
9597
9632
|
...fetcher,
|
|
9598
9633
|
data: data2
|
|
9599
9634
|
}),
|
|
9600
|
-
[FetcherForm, submit, load, fetcher, data2]
|
|
9635
|
+
[FetcherForm, submit, load, unstable_reset, fetcher, data2]
|
|
9601
9636
|
);
|
|
9602
9637
|
return fetcherWithComponents;
|
|
9603
9638
|
}
|
|
@@ -10008,6 +10043,9 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
10008
10043
|
deleteFetcher() {
|
|
10009
10044
|
throw msg("deleteFetcher");
|
|
10010
10045
|
},
|
|
10046
|
+
resetFetcher() {
|
|
10047
|
+
throw msg("resetFetcher");
|
|
10048
|
+
},
|
|
10011
10049
|
dispose() {
|
|
10012
10050
|
throw msg("dispose");
|
|
10013
10051
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.9.
|
|
2
|
+
* react-router v7.9.2-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
withComponentProps,
|
|
60
60
|
withErrorBoundaryProps,
|
|
61
61
|
withHydrateFallbackProps
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-662O2YDJ.mjs";
|
|
63
63
|
|
|
64
64
|
// lib/dom/ssr/server.tsx
|
|
65
65
|
import * as React from "react";
|
|
@@ -192,6 +192,12 @@ function processRoutes(routes, context, manifest, routeModules, parentId) {
|
|
|
192
192
|
ErrorBoundary: route.ErrorBoundary ? withErrorBoundaryProps(route.ErrorBoundary) : void 0,
|
|
193
193
|
action: route.action ? (args) => route.action({ ...args, context }) : void 0,
|
|
194
194
|
loader: route.loader ? (args) => route.loader({ ...args, context }) : void 0,
|
|
195
|
+
middleware: route.middleware ? route.middleware.map(
|
|
196
|
+
(mw) => (...args) => mw(
|
|
197
|
+
{ ...args[0], context },
|
|
198
|
+
args[1]
|
|
199
|
+
)
|
|
200
|
+
) : void 0,
|
|
195
201
|
handle: route.handle,
|
|
196
202
|
shouldRevalidate: route.shouldRevalidate
|
|
197
203
|
};
|
|
@@ -1234,9 +1240,11 @@ async function handleManifestRequest(build, routes, url) {
|
|
|
1234
1240
|
});
|
|
1235
1241
|
}
|
|
1236
1242
|
let patches = {};
|
|
1237
|
-
if (url.searchParams.has("
|
|
1243
|
+
if (url.searchParams.has("paths")) {
|
|
1238
1244
|
let paths = /* @__PURE__ */ new Set();
|
|
1239
|
-
url.searchParams.
|
|
1245
|
+
let pathParam = url.searchParams.get("paths") || "";
|
|
1246
|
+
let requestedPaths = pathParam.split(",").filter(Boolean);
|
|
1247
|
+
requestedPaths.forEach((path) => {
|
|
1240
1248
|
if (!path.startsWith("/")) {
|
|
1241
1249
|
path = `/${path}`;
|
|
1242
1250
|
}
|
|
@@ -2407,7 +2415,7 @@ function getManifestUrl(paths) {
|
|
|
2407
2415
|
""
|
|
2408
2416
|
);
|
|
2409
2417
|
let url = new URL(`${basename}/.manifest`, window.location.origin);
|
|
2410
|
-
|
|
2418
|
+
url.searchParams.set("paths", paths.sort().join(","));
|
|
2411
2419
|
return url;
|
|
2412
2420
|
}
|
|
2413
2421
|
async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fetchImplementation, signal) {
|
|
@@ -2601,8 +2609,28 @@ async function routeRSCServerRequest({
|
|
|
2601
2609
|
}
|
|
2602
2610
|
});
|
|
2603
2611
|
};
|
|
2604
|
-
|
|
2605
|
-
|
|
2612
|
+
let deepestRenderedBoundaryId = null;
|
|
2613
|
+
const getPayload = () => {
|
|
2614
|
+
const payloadPromise = Promise.resolve(
|
|
2615
|
+
createFromReadableStream(createStream())
|
|
2616
|
+
);
|
|
2617
|
+
return Object.defineProperties(payloadPromise, {
|
|
2618
|
+
_deepestRenderedBoundaryId: {
|
|
2619
|
+
get() {
|
|
2620
|
+
return deepestRenderedBoundaryId;
|
|
2621
|
+
},
|
|
2622
|
+
set(boundaryId) {
|
|
2623
|
+
deepestRenderedBoundaryId = boundaryId;
|
|
2624
|
+
}
|
|
2625
|
+
},
|
|
2626
|
+
formState: {
|
|
2627
|
+
get() {
|
|
2628
|
+
return payloadPromise.then(
|
|
2629
|
+
(payload) => payload.type === "render" ? payload.formState : void 0
|
|
2630
|
+
);
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2633
|
+
});
|
|
2606
2634
|
};
|
|
2607
2635
|
try {
|
|
2608
2636
|
if (!detectRedirectResponse.body) {
|
|
@@ -2626,7 +2654,7 @@ async function routeRSCServerRequest({
|
|
|
2626
2654
|
}
|
|
2627
2655
|
const html = await renderHTML(getPayload);
|
|
2628
2656
|
const headers = new Headers(serverResponse.headers);
|
|
2629
|
-
headers.set("Content-Type", "text/html");
|
|
2657
|
+
headers.set("Content-Type", "text/html; charset=utf-8");
|
|
2630
2658
|
if (!hydrate) {
|
|
2631
2659
|
return new Response(html, {
|
|
2632
2660
|
status: serverResponse.status,
|
|
@@ -2645,11 +2673,62 @@ async function routeRSCServerRequest({
|
|
|
2645
2673
|
if (reason instanceof Response) {
|
|
2646
2674
|
return reason;
|
|
2647
2675
|
}
|
|
2676
|
+
try {
|
|
2677
|
+
const status = isRouteErrorResponse(reason) ? reason.status : 500;
|
|
2678
|
+
const html = await renderHTML(() => {
|
|
2679
|
+
const decoded = Promise.resolve(
|
|
2680
|
+
createFromReadableStream(createStream())
|
|
2681
|
+
);
|
|
2682
|
+
const payloadPromise = decoded.then(
|
|
2683
|
+
(payload) => Object.assign(payload, {
|
|
2684
|
+
status,
|
|
2685
|
+
errors: deepestRenderedBoundaryId ? {
|
|
2686
|
+
[deepestRenderedBoundaryId]: reason
|
|
2687
|
+
} : {}
|
|
2688
|
+
})
|
|
2689
|
+
);
|
|
2690
|
+
return Object.defineProperties(payloadPromise, {
|
|
2691
|
+
_deepestRenderedBoundaryId: {
|
|
2692
|
+
get() {
|
|
2693
|
+
return deepestRenderedBoundaryId;
|
|
2694
|
+
},
|
|
2695
|
+
set(boundaryId) {
|
|
2696
|
+
deepestRenderedBoundaryId = boundaryId;
|
|
2697
|
+
}
|
|
2698
|
+
},
|
|
2699
|
+
formState: {
|
|
2700
|
+
get() {
|
|
2701
|
+
return payloadPromise.then(
|
|
2702
|
+
(payload) => payload.type === "render" ? payload.formState : void 0
|
|
2703
|
+
);
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
});
|
|
2707
|
+
});
|
|
2708
|
+
const headers = new Headers(serverResponse.headers);
|
|
2709
|
+
headers.set("Content-Type", "text/html");
|
|
2710
|
+
if (!hydrate) {
|
|
2711
|
+
return new Response(html, {
|
|
2712
|
+
status,
|
|
2713
|
+
headers
|
|
2714
|
+
});
|
|
2715
|
+
}
|
|
2716
|
+
if (!serverResponseB?.body) {
|
|
2717
|
+
throw new Error("Failed to clone server response");
|
|
2718
|
+
}
|
|
2719
|
+
const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body));
|
|
2720
|
+
return new Response(body2, {
|
|
2721
|
+
status,
|
|
2722
|
+
headers
|
|
2723
|
+
});
|
|
2724
|
+
} catch {
|
|
2725
|
+
}
|
|
2648
2726
|
throw reason;
|
|
2649
2727
|
}
|
|
2650
2728
|
}
|
|
2651
2729
|
function RSCStaticRouter({ getPayload }) {
|
|
2652
|
-
const
|
|
2730
|
+
const decoded = getPayload();
|
|
2731
|
+
const payload = useSafe(decoded);
|
|
2653
2732
|
if (payload.type === "redirect") {
|
|
2654
2733
|
throw new Response(null, {
|
|
2655
2734
|
status: payload.status,
|
|
@@ -2671,6 +2750,12 @@ function RSCStaticRouter({ getPayload }) {
|
|
|
2671
2750
|
}
|
|
2672
2751
|
}
|
|
2673
2752
|
const context = {
|
|
2753
|
+
get _deepestRenderedBoundaryId() {
|
|
2754
|
+
return decoded._deepestRenderedBoundaryId ?? null;
|
|
2755
|
+
},
|
|
2756
|
+
set _deepestRenderedBoundaryId(boundaryId) {
|
|
2757
|
+
decoded._deepestRenderedBoundaryId = boundaryId;
|
|
2758
|
+
},
|
|
2674
2759
|
actionData: payload.actionData,
|
|
2675
2760
|
actionHeaders: {},
|
|
2676
2761
|
basename: payload.basename,
|