react-router 0.0.0-experimental-e0e92e3b1 → 0.0.0-experimental-0fd8a0272
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/dist/development/{browser-Cd-LzL5m.d.mts → browser-B_fyLsf9.d.mts} +12 -2
- package/dist/development/{browser-C3X761mx.d.ts → browser-Dpxu0wdb.d.ts} +12 -2
- package/dist/development/{chunk-ZUOEVBB4.mjs → chunk-E7S3F3DO.mjs} +81 -20
- package/dist/development/dom-export.d.mts +1 -1
- package/dist/development/dom-export.d.ts +1 -1
- package/dist/development/dom-export.js +8 -7
- package/dist/development/dom-export.mjs +2 -2
- package/dist/development/index.d.mts +2 -2
- package/dist/development/index.d.ts +2 -2
- package/dist/development/index.js +81 -20
- package/dist/development/index.mjs +2 -2
- package/dist/development/lib/types/route-module.js +1 -1
- package/dist/development/lib/types/route-module.mjs +1 -1
- package/dist/development/server.d.mts +37 -3
- package/dist/development/server.d.ts +37 -3
- package/dist/development/server.js +110 -42
- package/dist/development/server.mjs +108 -43
- package/dist/production/{browser-Cd-LzL5m.d.mts → browser-B_fyLsf9.d.mts} +12 -2
- package/dist/production/{browser-C3X761mx.d.ts → browser-Dpxu0wdb.d.ts} +12 -2
- package/dist/production/{chunk-TS5MBYTJ.mjs → chunk-OBBSTJVM.mjs} +81 -20
- package/dist/production/dom-export.d.mts +1 -1
- package/dist/production/dom-export.d.ts +1 -1
- package/dist/production/dom-export.js +8 -7
- package/dist/production/dom-export.mjs +2 -2
- package/dist/production/index.d.mts +2 -2
- package/dist/production/index.d.ts +2 -2
- package/dist/production/index.js +81 -20
- package/dist/production/index.mjs +2 -2
- package/dist/production/lib/types/route-module.js +1 -1
- package/dist/production/lib/types/route-module.mjs +1 -1
- package/dist/production/server.d.mts +37 -3
- package/dist/production/server.d.ts +37 -3
- package/dist/production/server.js +110 -42
- package/dist/production/server.mjs +108 -43
- package/package.json +1 -1
|
@@ -1719,18 +1719,27 @@ type ServerRenderPayload = {
|
|
|
1719
1719
|
loaderData: Record<string, any>;
|
|
1720
1720
|
location: Location;
|
|
1721
1721
|
matches: ServerRouteMatch[];
|
|
1722
|
+
patches: RenderedRoute[];
|
|
1722
1723
|
nonce?: string;
|
|
1723
1724
|
};
|
|
1724
1725
|
type ServerManifestPayload = {
|
|
1725
1726
|
type: "manifest";
|
|
1726
1727
|
matches: RenderedRoute[];
|
|
1728
|
+
patches: RenderedRoute[];
|
|
1727
1729
|
};
|
|
1728
1730
|
type ServerActionPayload = {
|
|
1729
1731
|
type: "action";
|
|
1730
1732
|
actionResult: Promise<unknown>;
|
|
1731
|
-
rerender?: Promise<ServerRenderPayload>;
|
|
1733
|
+
rerender?: Promise<ServerRenderPayload | ServerRedirectPayload>;
|
|
1732
1734
|
};
|
|
1733
|
-
type
|
|
1735
|
+
type ServerRedirectPayload = {
|
|
1736
|
+
type: "redirect";
|
|
1737
|
+
status: number;
|
|
1738
|
+
location: string;
|
|
1739
|
+
replace: boolean;
|
|
1740
|
+
reload: boolean;
|
|
1741
|
+
};
|
|
1742
|
+
type ServerPayload = ServerRenderPayload | ServerManifestPayload | ServerActionPayload | ServerRedirectPayload;
|
|
1734
1743
|
|
|
1735
1744
|
type DecodeServerResponseFunction = (body: ReadableStream<Uint8Array>) => Promise<ServerPayload>;
|
|
1736
1745
|
type EncodeActionFunction = (args: unknown[]) => Promise<BodyInit>;
|
|
@@ -1738,6 +1747,7 @@ declare global {
|
|
|
1738
1747
|
interface Window {
|
|
1739
1748
|
__router: Router$1;
|
|
1740
1749
|
__routerInitialized: boolean;
|
|
1750
|
+
__routerActionID: number;
|
|
1741
1751
|
}
|
|
1742
1752
|
}
|
|
1743
1753
|
declare function createCallServer({ decode, encodeAction, }: {
|
|
@@ -1719,18 +1719,27 @@ type ServerRenderPayload = {
|
|
|
1719
1719
|
loaderData: Record<string, any>;
|
|
1720
1720
|
location: Location;
|
|
1721
1721
|
matches: ServerRouteMatch[];
|
|
1722
|
+
patches: RenderedRoute[];
|
|
1722
1723
|
nonce?: string;
|
|
1723
1724
|
};
|
|
1724
1725
|
type ServerManifestPayload = {
|
|
1725
1726
|
type: "manifest";
|
|
1726
1727
|
matches: RenderedRoute[];
|
|
1728
|
+
patches: RenderedRoute[];
|
|
1727
1729
|
};
|
|
1728
1730
|
type ServerActionPayload = {
|
|
1729
1731
|
type: "action";
|
|
1730
1732
|
actionResult: Promise<unknown>;
|
|
1731
|
-
rerender?: Promise<ServerRenderPayload>;
|
|
1733
|
+
rerender?: Promise<ServerRenderPayload | ServerRedirectPayload>;
|
|
1732
1734
|
};
|
|
1733
|
-
type
|
|
1735
|
+
type ServerRedirectPayload = {
|
|
1736
|
+
type: "redirect";
|
|
1737
|
+
status: number;
|
|
1738
|
+
location: string;
|
|
1739
|
+
replace: boolean;
|
|
1740
|
+
reload: boolean;
|
|
1741
|
+
};
|
|
1742
|
+
type ServerPayload = ServerRenderPayload | ServerManifestPayload | ServerActionPayload | ServerRedirectPayload;
|
|
1734
1743
|
|
|
1735
1744
|
type DecodeServerResponseFunction = (body: ReadableStream<Uint8Array>) => Promise<ServerPayload>;
|
|
1736
1745
|
type EncodeActionFunction = (args: unknown[]) => Promise<BodyInit>;
|
|
@@ -1738,6 +1747,7 @@ declare global {
|
|
|
1738
1747
|
interface Window {
|
|
1739
1748
|
__router: Router$1;
|
|
1740
1749
|
__routerInitialized: boolean;
|
|
1750
|
+
__routerActionID: number;
|
|
1741
1751
|
}
|
|
1742
1752
|
}
|
|
1743
1753
|
declare function createCallServer({ decode, encodeAction, }: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-0fd8a0272
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2538,8 +2538,7 @@ function createRouter(init) {
|
|
|
2538
2538
|
);
|
|
2539
2539
|
return { active: true, matches: fogMatches || [] };
|
|
2540
2540
|
} else {
|
|
2541
|
-
|
|
2542
|
-
if (Object.keys(matches[0].params).length > 0 || !lastRoute?.route.index && lastRoute?.route.path === "") {
|
|
2541
|
+
if (Object.keys(matches[0].params).length > 0) {
|
|
2543
2542
|
let partialMatches = matchRoutesImpl(
|
|
2544
2543
|
routesToUse,
|
|
2545
2544
|
pathname,
|
|
@@ -4038,7 +4037,7 @@ function getDataStrategyMatch(mapRouteProperties2, manifest, request, match, laz
|
|
|
4038
4037
|
return shouldRevalidateLoader(match, unstable_shouldRevalidateArgs);
|
|
4039
4038
|
},
|
|
4040
4039
|
resolve(handlerOverride) {
|
|
4041
|
-
if (isUsingNewApi || shouldLoad || handlerOverride && request.method
|
|
4040
|
+
if (isUsingNewApi || shouldLoad || handlerOverride && !isMutationMethod(request.method) && (match.route.lazy || match.route.loader)) {
|
|
4042
4041
|
return callLoaderOrAction({
|
|
4043
4042
|
request,
|
|
4044
4043
|
match,
|
|
@@ -6580,7 +6579,7 @@ async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, f
|
|
|
6580
6579
|
);
|
|
6581
6580
|
await Promise.all(routeDfds.map((d) => d.promise));
|
|
6582
6581
|
if ((!router.state.initialized || routesParams.size === 0) && !window.__reactRouterHdrActive) {
|
|
6583
|
-
singleFetchDfd.resolve({});
|
|
6582
|
+
singleFetchDfd.resolve({ routes: {} });
|
|
6584
6583
|
} else {
|
|
6585
6584
|
let targetRoutes = ssr && foundOptOutRoute && routesParams.size > 0 ? [...routesParams.keys()] : void 0;
|
|
6586
6585
|
try {
|
|
@@ -6737,12 +6736,14 @@ function unwrapSingleFetchResult(result, routeId) {
|
|
|
6737
6736
|
});
|
|
6738
6737
|
}
|
|
6739
6738
|
let routeResult = result.routes[routeId];
|
|
6740
|
-
if (
|
|
6739
|
+
if (!routeResult) {
|
|
6740
|
+
return void 0;
|
|
6741
|
+
} else if ("error" in routeResult) {
|
|
6741
6742
|
throw routeResult.error;
|
|
6742
6743
|
} else if ("data" in routeResult) {
|
|
6743
6744
|
return routeResult.data;
|
|
6744
6745
|
} else {
|
|
6745
|
-
throw new Error(`
|
|
6746
|
+
throw new Error(`Invalid response found for routeId "${routeId}"`);
|
|
6746
6747
|
}
|
|
6747
6748
|
}
|
|
6748
6749
|
function createDeferred2() {
|
|
@@ -7981,7 +7982,7 @@ function mergeRefs(...refs) {
|
|
|
7981
7982
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
7982
7983
|
try {
|
|
7983
7984
|
if (isBrowser) {
|
|
7984
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
7985
|
+
window.__reactRouterVersion = "0.0.0-experimental-0fd8a0272";
|
|
7985
7986
|
}
|
|
7986
7987
|
} catch (e) {
|
|
7987
7988
|
}
|
|
@@ -10706,11 +10707,9 @@ function createCallServer({
|
|
|
10706
10707
|
decode: decode2,
|
|
10707
10708
|
encodeAction
|
|
10708
10709
|
}) {
|
|
10709
|
-
let actionCounter = 0;
|
|
10710
10710
|
let landedActionId = 0;
|
|
10711
10711
|
return async (id, args) => {
|
|
10712
|
-
let actionId =
|
|
10713
|
-
const locationKey = window.__router.state.loaderData;
|
|
10712
|
+
let actionId = window.__routerActionID = (window.__routerActionID ?? (window.__routerActionID = 0)) + 1;
|
|
10714
10713
|
const response = await fetch(location.href, {
|
|
10715
10714
|
body: await encodeAction(args),
|
|
10716
10715
|
method: "POST",
|
|
@@ -10728,12 +10727,22 @@ function createCallServer({
|
|
|
10728
10727
|
}
|
|
10729
10728
|
if (payload.rerender) {
|
|
10730
10729
|
(async () => {
|
|
10731
|
-
const
|
|
10732
|
-
if (!
|
|
10733
|
-
if (
|
|
10730
|
+
const rerender = await payload.rerender;
|
|
10731
|
+
if (!rerender) return;
|
|
10732
|
+
if (landedActionId < actionId && window.__routerActionID <= actionId) {
|
|
10734
10733
|
landedActionId = actionId;
|
|
10734
|
+
if (rerender.type === "redirect") {
|
|
10735
|
+
if (rerender.reload) {
|
|
10736
|
+
window.location.href = rerender.location;
|
|
10737
|
+
return;
|
|
10738
|
+
}
|
|
10739
|
+
window.__router.navigate(rerender.location, {
|
|
10740
|
+
replace: rerender.replace
|
|
10741
|
+
});
|
|
10742
|
+
return;
|
|
10743
|
+
}
|
|
10735
10744
|
let lastMatch;
|
|
10736
|
-
for (const match of
|
|
10745
|
+
for (const match of rerender.matches) {
|
|
10737
10746
|
window.__router.patchRoutes(
|
|
10738
10747
|
lastMatch?.id ?? null,
|
|
10739
10748
|
[createRouteFromServerManifest(match)],
|
|
@@ -10741,17 +10750,18 @@ function createCallServer({
|
|
|
10741
10750
|
);
|
|
10742
10751
|
lastMatch = match;
|
|
10743
10752
|
}
|
|
10753
|
+
window.__router._internalSetStateDoNotUseOrYouWillBreakYourApp({});
|
|
10744
10754
|
React14.startTransition(() => {
|
|
10745
10755
|
window.__router._internalSetStateDoNotUseOrYouWillBreakYourApp({
|
|
10746
10756
|
loaderData: Object.assign(
|
|
10747
10757
|
{},
|
|
10748
10758
|
window.__router.state.loaderData,
|
|
10749
|
-
|
|
10759
|
+
rerender.loaderData
|
|
10750
10760
|
),
|
|
10751
|
-
errors:
|
|
10761
|
+
errors: rerender.errors ? Object.assign(
|
|
10752
10762
|
{},
|
|
10753
10763
|
window.__router.state.errors,
|
|
10754
|
-
|
|
10764
|
+
rerender.errors
|
|
10755
10765
|
) : null
|
|
10756
10766
|
});
|
|
10757
10767
|
});
|
|
@@ -10767,6 +10777,14 @@ function createRouterFromPayload({
|
|
|
10767
10777
|
}) {
|
|
10768
10778
|
if (window.__router) return window.__router;
|
|
10769
10779
|
if (payload.type !== "render") throw new Error("Invalid payload type");
|
|
10780
|
+
let patches = /* @__PURE__ */ new Map();
|
|
10781
|
+
payload.patches.forEach((patch) => {
|
|
10782
|
+
invariant(patch.parentId, "Invalid patch parentId");
|
|
10783
|
+
if (!patches.has(patch.parentId)) {
|
|
10784
|
+
patches.set(patch.parentId, []);
|
|
10785
|
+
}
|
|
10786
|
+
patches.get(patch.parentId)?.push(patch);
|
|
10787
|
+
});
|
|
10770
10788
|
let routes = payload.matches.reduceRight((previous, match) => {
|
|
10771
10789
|
const route = createRouteFromServerManifest(
|
|
10772
10790
|
match,
|
|
@@ -10774,6 +10792,12 @@ function createRouterFromPayload({
|
|
|
10774
10792
|
);
|
|
10775
10793
|
if (previous.length > 0) {
|
|
10776
10794
|
route.children = previous;
|
|
10795
|
+
let childrenToPatch = patches.get(match.id);
|
|
10796
|
+
if (childrenToPatch) {
|
|
10797
|
+
route.children.push(
|
|
10798
|
+
...childrenToPatch.map((r) => createRouteFromServerManifest(r))
|
|
10799
|
+
);
|
|
10800
|
+
}
|
|
10777
10801
|
}
|
|
10778
10802
|
return [route];
|
|
10779
10803
|
}, []);
|
|
@@ -10813,6 +10837,9 @@ function createRouterFromPayload({
|
|
|
10813
10837
|
createRouteFromServerManifest(match)
|
|
10814
10838
|
])
|
|
10815
10839
|
);
|
|
10840
|
+
payload2.patches.forEach((p) => {
|
|
10841
|
+
patch(p.parentId ?? null, [createRouteFromServerManifest(p)]);
|
|
10842
|
+
});
|
|
10816
10843
|
},
|
|
10817
10844
|
// FIXME: Pass `build.ssr` and `build.basename` into this function
|
|
10818
10845
|
dataStrategy: getRSCSingleFetchDataStrategy(
|
|
@@ -10828,6 +10855,12 @@ function createRouterFromPayload({
|
|
|
10828
10855
|
} else {
|
|
10829
10856
|
window.__routerInitialized = false;
|
|
10830
10857
|
}
|
|
10858
|
+
let lastLocationKey = window.__router.state.location.key;
|
|
10859
|
+
window.__router.subscribe(({ location: location2 }) => {
|
|
10860
|
+
if (location2.key !== lastLocationKey) {
|
|
10861
|
+
window.__routerActionID = (window.__routerActionID ?? (window.__routerActionID = 0)) + 1;
|
|
10862
|
+
}
|
|
10863
|
+
});
|
|
10831
10864
|
return window.__router;
|
|
10832
10865
|
}
|
|
10833
10866
|
var renderedRoutesContext = unstable_createContext();
|
|
@@ -10886,6 +10919,20 @@ function getFetchAndDecodeViaRSC(decode2) {
|
|
|
10886
10919
|
invariant(res.body, "No response body to decode");
|
|
10887
10920
|
try {
|
|
10888
10921
|
const payload = await decode2(res.body);
|
|
10922
|
+
if (payload.type === "redirect") {
|
|
10923
|
+
return {
|
|
10924
|
+
status: res.status,
|
|
10925
|
+
data: {
|
|
10926
|
+
redirect: {
|
|
10927
|
+
redirect: payload.location,
|
|
10928
|
+
reload: false,
|
|
10929
|
+
replace: payload.replace,
|
|
10930
|
+
revalidate: false,
|
|
10931
|
+
status: payload.status
|
|
10932
|
+
}
|
|
10933
|
+
}
|
|
10934
|
+
};
|
|
10935
|
+
}
|
|
10889
10936
|
if (payload.type !== "render") {
|
|
10890
10937
|
throw new Error("Unexpected payload type");
|
|
10891
10938
|
}
|
|
@@ -10987,7 +11034,11 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
10987
11034
|
} finally {
|
|
10988
11035
|
isHydrationRequest = false;
|
|
10989
11036
|
}
|
|
10990
|
-
} :
|
|
11037
|
+
} : (
|
|
11038
|
+
// We always make the call in this RSC world since even if we don't
|
|
11039
|
+
// have a `loader` we may need to get the `element` implementation
|
|
11040
|
+
(_, singleFetch) => callSingleFetch(singleFetch)
|
|
11041
|
+
),
|
|
10991
11042
|
action: match.clientAction ? (args, singleFetch) => match.clientAction({
|
|
10992
11043
|
...args,
|
|
10993
11044
|
serverAction: async () => {
|
|
@@ -11001,7 +11052,9 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
11001
11052
|
}) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : void 0,
|
|
11002
11053
|
path: match.path,
|
|
11003
11054
|
shouldRevalidate: match.shouldRevalidate,
|
|
11004
|
-
|
|
11055
|
+
// We always have a "loader" in this RSC world since even if we don't
|
|
11056
|
+
// have a `loader` we may need to get the `element` implementation
|
|
11057
|
+
hasLoader: true,
|
|
11005
11058
|
hasClientLoader: match.clientLoader != null,
|
|
11006
11059
|
hasAction: match.hasAction,
|
|
11007
11060
|
hasClientAction: match.clientAction != null,
|
|
@@ -11153,6 +11206,14 @@ async function routeServerRequest(request, requestServer, decode2, renderHTML) {
|
|
|
11153
11206
|
throw new Error("Failed to clone server response");
|
|
11154
11207
|
}
|
|
11155
11208
|
const payload = await decode2(serverResponse.body);
|
|
11209
|
+
if (payload.type === "redirect") {
|
|
11210
|
+
return new Response(null, {
|
|
11211
|
+
status: payload.status,
|
|
11212
|
+
headers: {
|
|
11213
|
+
Location: payload.location
|
|
11214
|
+
}
|
|
11215
|
+
});
|
|
11216
|
+
}
|
|
11156
11217
|
const html = await renderHTML(payload);
|
|
11157
11218
|
try {
|
|
11158
11219
|
const body = html.pipeThrough(injectRSCPayload(serverResponseB.body));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './browser-
|
|
2
|
+
import { R as RouterProviderProps$1 } from './browser-B_fyLsf9.mjs';
|
|
3
3
|
import { R as RouterInit } from './route-data-DX3MskAN.mjs';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './browser-
|
|
2
|
+
import { R as RouterProviderProps$1 } from './browser-Dpxu0wdb.js';
|
|
3
3
|
import { R as RouterInit } from './route-data-DX3MskAN.js';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-0fd8a0272
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2392,8 +2392,7 @@ function createRouter(init) {
|
|
|
2392
2392
|
);
|
|
2393
2393
|
return { active: true, matches: fogMatches || [] };
|
|
2394
2394
|
} else {
|
|
2395
|
-
|
|
2396
|
-
if (Object.keys(matches[0].params).length > 0 || !lastRoute?.route.index && lastRoute?.route.path === "") {
|
|
2395
|
+
if (Object.keys(matches[0].params).length > 0) {
|
|
2397
2396
|
let partialMatches = matchRoutesImpl(
|
|
2398
2397
|
routesToUse,
|
|
2399
2398
|
pathname,
|
|
@@ -3284,7 +3283,7 @@ function getDataStrategyMatch(mapRouteProperties2, manifest, request, match, laz
|
|
|
3284
3283
|
return shouldRevalidateLoader(match, unstable_shouldRevalidateArgs);
|
|
3285
3284
|
},
|
|
3286
3285
|
resolve(handlerOverride) {
|
|
3287
|
-
if (isUsingNewApi || shouldLoad || handlerOverride && request.method
|
|
3286
|
+
if (isUsingNewApi || shouldLoad || handlerOverride && !isMutationMethod(request.method) && (match.route.lazy || match.route.loader)) {
|
|
3288
3287
|
return callLoaderOrAction({
|
|
3289
3288
|
request,
|
|
3290
3289
|
match,
|
|
@@ -5037,7 +5036,7 @@ async function singleFetchLoaderNavigationStrategy(args, router2, getRouteInfo,
|
|
|
5037
5036
|
);
|
|
5038
5037
|
await Promise.all(routeDfds.map((d) => d.promise));
|
|
5039
5038
|
if ((!router2.state.initialized || routesParams.size === 0) && !window.__reactRouterHdrActive) {
|
|
5040
|
-
singleFetchDfd.resolve({});
|
|
5039
|
+
singleFetchDfd.resolve({ routes: {} });
|
|
5041
5040
|
} else {
|
|
5042
5041
|
let targetRoutes = ssr && foundOptOutRoute && routesParams.size > 0 ? [...routesParams.keys()] : void 0;
|
|
5043
5042
|
try {
|
|
@@ -5194,12 +5193,14 @@ function unwrapSingleFetchResult(result, routeId) {
|
|
|
5194
5193
|
});
|
|
5195
5194
|
}
|
|
5196
5195
|
let routeResult = result.routes[routeId];
|
|
5197
|
-
if (
|
|
5196
|
+
if (!routeResult) {
|
|
5197
|
+
return void 0;
|
|
5198
|
+
} else if ("error" in routeResult) {
|
|
5198
5199
|
throw routeResult.error;
|
|
5199
5200
|
} else if ("data" in routeResult) {
|
|
5200
5201
|
return routeResult.data;
|
|
5201
5202
|
} else {
|
|
5202
|
-
throw new Error(`
|
|
5203
|
+
throw new Error(`Invalid response found for routeId "${routeId}"`);
|
|
5203
5204
|
}
|
|
5204
5205
|
}
|
|
5205
5206
|
function createDeferred2() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-0fd8a0272
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
invariant,
|
|
26
26
|
mapRouteProperties,
|
|
27
27
|
useFogOFWarDiscovery
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-E7S3F3DO.mjs";
|
|
29
29
|
|
|
30
30
|
// lib/dom-export/dom-router-provider.tsx
|
|
31
31
|
import * as React from "react";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as Router, b as RouteModules, D as DataStrategyFunction, c as RouteManifest, S as ServerRouteModule, M as MiddlewareEnabled, u as unstable_RouterContextProvider, L as LoaderFunctionArgs, A as ActionFunctionArgs, T as To, d as RelativeRoutingType, e as Location, f as Action, P as ParamParseKey, g as Path, h as PathPattern, i as PathMatch, N as NavigateOptions, j as Params$1, k as RouteObject, l as Navigation, m as RevalidationState, U as UIMatch, n as SerializeFrom, B as BlockerFunction, o as Blocker, p as StaticHandlerContext, q as StaticHandler, F as FutureConfig$1, C as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, r as unstable_InitialContext, s as IndexRouteObject, t as LoaderFunction, v as ActionFunction, w as MetaFunction, x as LinksFunction, y as NonIndexRouteObject, E as Equal, z as RouterState, G as DataRouteObject, J as ClientLoaderFunction } from './route-data-DX3MskAN.mjs';
|
|
2
2
|
export { aw as ClientActionFunction, ax as ClientActionFunctionArgs, ay as ClientLoaderFunctionArgs, ar as DataRouteMatch, Z as DataStrategyFunctionArgs, _ as DataStrategyMatch, $ as DataStrategyResult, a1 as ErrorResponse, Q as Fetcher, a2 as FormEncType, a3 as FormMethod, aG as Future, K as GetScrollPositionFunction, O as GetScrollRestorationKeyFunction, a4 as HTMLFormMethod, az as HeadersArgs, aA as HeadersFunction, aE as HtmlLinkDescriptor, ah as IDLE_BLOCKER, ag as IDLE_FETCHER, af as IDLE_NAVIGATION, a5 as LazyRouteFunction, aF as LinkDescriptor, aB as MetaArgs, aC as MetaDescriptor, V as NavigationStates, as as Navigator, aD as PageLinkDescriptor, at as PatchRoutesOnNavigationFunction, au as PatchRoutesOnNavigationFunctionArgs, a7 as PathParam, a8 as RedirectFunction, av as RouteMatch, Y as RouterFetchOptions, R as RouterInit, X as RouterNavigateOptions, W as RouterSubscriber, aa as ShouldRevalidateFunction, ab as ShouldRevalidateFunctionArgs, aM as UNSAFE_DataRouterContext, aN as UNSAFE_DataRouterStateContext, a0 as UNSAFE_DataWithResponseInit, aL as UNSAFE_ErrorResponseImpl, aO as UNSAFE_FetchersContext, aP as UNSAFE_LocationContext, aQ as UNSAFE_NavigationContext, aR as UNSAFE_RouteContext, aS as UNSAFE_ViewTransitionContext, aI as UNSAFE_createBrowserHistory, aK as UNSAFE_createRouter, aJ as UNSAFE_invariant, ad as createPath, ai as data, aj as generatePath, ak as isRouteErrorResponse, al as matchPath, am as matchRoutes, ae as parsePath, an as redirect, ao as redirectDocument, ap as replace, aq as resolvePath, a6 as unstable_MiddlewareFunction, a9 as unstable_RouterContext, aH as unstable_SerializesTo, ac as unstable_createContext } from './route-data-DX3MskAN.mjs';
|
|
3
|
-
import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext, C as CriticalCss, S as ServerPayload } from './browser-
|
|
4
|
-
export { g as Await, b as AwaitProps, U as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, as as DecodeServerResponseFunction, at as EncodeActionFunction, w as FetcherFormProps, J as FetcherSubmitFunction, a8 as FetcherSubmitOptions, K as FetcherWithComponents, Z as Form, x as FormProps, V as HashRouter, H as HashRouterProps, s as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, W as Link, t as LinkProps, af as Links, h as MemoryRouter, M as MemoryRouterOpts, c as MemoryRouterProps, ae as Meta, Y as NavLink, u as NavLinkProps, v as NavLinkRenderProps, i as Navigate, N as NavigateProps, j as Outlet, O as OutletProps, a9 as ParamKeyValuePair, P as PathRouteProps, ah as PrefetchPageLinks, k as Route, d as RouteProps, l as Router, e as RouterProps, m as RouterProvider, R as RouterProviderProps, n as Routes, f as RoutesProps, ag as Scripts, ai as ScriptsProps, _ as ScrollRestoration, y as ScrollRestorationProps, av as ServerBrowserRouter, z as SetURLSearchParams, G as SubmitFunction, aa as SubmitOptions, ac as SubmitTarget, al as UNSAFE_FrameworkContext, ao as UNSAFE_createClientRoutes, ap as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, am as UNSAFE_getPatchRoutesOnNavigationFunction, aj as UNSAFE_hydrationRouteProperties, ak as UNSAFE_mapRouteProperties, aq as UNSAFE_shouldHydrateRouteLoader, an as UNSAFE_useFogOFWarDiscovery, ar as UNSAFE_useScrollRestoration, ab as URLSearchParamsInit, Q as createBrowserRouter, au as createCallServer, T as createHashRouter, o as createMemoryRouter, p as createRoutesFromChildren, q as createRoutesFromElements, ad as createSearchParams, aw as getServerStream, r as renderMatches, X as unstable_HistoryRouter, a6 as unstable_usePrompt, a5 as useBeforeUnload, a3 as useFetcher, a4 as useFetchers, a2 as useFormAction, $ as useLinkClickHandler, a0 as useSearchParams, a1 as useSubmit, a7 as useViewTransitionState } from './browser-
|
|
3
|
+
import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext, C as CriticalCss, S as ServerPayload } from './browser-B_fyLsf9.mjs';
|
|
4
|
+
export { g as Await, b as AwaitProps, U as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, as as DecodeServerResponseFunction, at as EncodeActionFunction, w as FetcherFormProps, J as FetcherSubmitFunction, a8 as FetcherSubmitOptions, K as FetcherWithComponents, Z as Form, x as FormProps, V as HashRouter, H as HashRouterProps, s as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, W as Link, t as LinkProps, af as Links, h as MemoryRouter, M as MemoryRouterOpts, c as MemoryRouterProps, ae as Meta, Y as NavLink, u as NavLinkProps, v as NavLinkRenderProps, i as Navigate, N as NavigateProps, j as Outlet, O as OutletProps, a9 as ParamKeyValuePair, P as PathRouteProps, ah as PrefetchPageLinks, k as Route, d as RouteProps, l as Router, e as RouterProps, m as RouterProvider, R as RouterProviderProps, n as Routes, f as RoutesProps, ag as Scripts, ai as ScriptsProps, _ as ScrollRestoration, y as ScrollRestorationProps, av as ServerBrowserRouter, z as SetURLSearchParams, G as SubmitFunction, aa as SubmitOptions, ac as SubmitTarget, al as UNSAFE_FrameworkContext, ao as UNSAFE_createClientRoutes, ap as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, am as UNSAFE_getPatchRoutesOnNavigationFunction, aj as UNSAFE_hydrationRouteProperties, ak as UNSAFE_mapRouteProperties, aq as UNSAFE_shouldHydrateRouteLoader, an as UNSAFE_useFogOFWarDiscovery, ar as UNSAFE_useScrollRestoration, ab as URLSearchParamsInit, Q as createBrowserRouter, au as createCallServer, T as createHashRouter, o as createMemoryRouter, p as createRoutesFromChildren, q as createRoutesFromElements, ad as createSearchParams, aw as getServerStream, r as renderMatches, X as unstable_HistoryRouter, a6 as unstable_usePrompt, a5 as useBeforeUnload, a3 as useFetcher, a4 as useFetchers, a2 as useFormAction, $ as useLinkClickHandler, a0 as useSearchParams, a1 as useSubmit, a7 as useViewTransitionState } from './browser-B_fyLsf9.mjs';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { ReactElement } from 'react';
|
|
7
7
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as Router, b as RouteModules, D as DataStrategyFunction, c as RouteManifest, S as ServerRouteModule, M as MiddlewareEnabled, u as unstable_RouterContextProvider, L as LoaderFunctionArgs, A as ActionFunctionArgs, T as To, d as RelativeRoutingType, e as Location, f as Action, P as ParamParseKey, g as Path, h as PathPattern, i as PathMatch, N as NavigateOptions, j as Params$1, k as RouteObject, l as Navigation, m as RevalidationState, U as UIMatch, n as SerializeFrom, B as BlockerFunction, o as Blocker, p as StaticHandlerContext, q as StaticHandler, F as FutureConfig$1, C as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, r as unstable_InitialContext, s as IndexRouteObject, t as LoaderFunction, v as ActionFunction, w as MetaFunction, x as LinksFunction, y as NonIndexRouteObject, E as Equal, z as RouterState, G as DataRouteObject, J as ClientLoaderFunction } from './route-data-DX3MskAN.js';
|
|
2
2
|
export { aw as ClientActionFunction, ax as ClientActionFunctionArgs, ay as ClientLoaderFunctionArgs, ar as DataRouteMatch, Z as DataStrategyFunctionArgs, _ as DataStrategyMatch, $ as DataStrategyResult, a1 as ErrorResponse, Q as Fetcher, a2 as FormEncType, a3 as FormMethod, aG as Future, K as GetScrollPositionFunction, O as GetScrollRestorationKeyFunction, a4 as HTMLFormMethod, az as HeadersArgs, aA as HeadersFunction, aE as HtmlLinkDescriptor, ah as IDLE_BLOCKER, ag as IDLE_FETCHER, af as IDLE_NAVIGATION, a5 as LazyRouteFunction, aF as LinkDescriptor, aB as MetaArgs, aC as MetaDescriptor, V as NavigationStates, as as Navigator, aD as PageLinkDescriptor, at as PatchRoutesOnNavigationFunction, au as PatchRoutesOnNavigationFunctionArgs, a7 as PathParam, a8 as RedirectFunction, av as RouteMatch, Y as RouterFetchOptions, R as RouterInit, X as RouterNavigateOptions, W as RouterSubscriber, aa as ShouldRevalidateFunction, ab as ShouldRevalidateFunctionArgs, aM as UNSAFE_DataRouterContext, aN as UNSAFE_DataRouterStateContext, a0 as UNSAFE_DataWithResponseInit, aL as UNSAFE_ErrorResponseImpl, aO as UNSAFE_FetchersContext, aP as UNSAFE_LocationContext, aQ as UNSAFE_NavigationContext, aR as UNSAFE_RouteContext, aS as UNSAFE_ViewTransitionContext, aI as UNSAFE_createBrowserHistory, aK as UNSAFE_createRouter, aJ as UNSAFE_invariant, ad as createPath, ai as data, aj as generatePath, ak as isRouteErrorResponse, al as matchPath, am as matchRoutes, ae as parsePath, an as redirect, ao as redirectDocument, ap as replace, aq as resolvePath, a6 as unstable_MiddlewareFunction, a9 as unstable_RouterContext, aH as unstable_SerializesTo, ac as unstable_createContext } from './route-data-DX3MskAN.js';
|
|
3
|
-
import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext, C as CriticalCss, S as ServerPayload } from './browser-
|
|
4
|
-
export { g as Await, b as AwaitProps, U as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, as as DecodeServerResponseFunction, at as EncodeActionFunction, w as FetcherFormProps, J as FetcherSubmitFunction, a8 as FetcherSubmitOptions, K as FetcherWithComponents, Z as Form, x as FormProps, V as HashRouter, H as HashRouterProps, s as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, W as Link, t as LinkProps, af as Links, h as MemoryRouter, M as MemoryRouterOpts, c as MemoryRouterProps, ae as Meta, Y as NavLink, u as NavLinkProps, v as NavLinkRenderProps, i as Navigate, N as NavigateProps, j as Outlet, O as OutletProps, a9 as ParamKeyValuePair, P as PathRouteProps, ah as PrefetchPageLinks, k as Route, d as RouteProps, l as Router, e as RouterProps, m as RouterProvider, R as RouterProviderProps, n as Routes, f as RoutesProps, ag as Scripts, ai as ScriptsProps, _ as ScrollRestoration, y as ScrollRestorationProps, av as ServerBrowserRouter, z as SetURLSearchParams, G as SubmitFunction, aa as SubmitOptions, ac as SubmitTarget, al as UNSAFE_FrameworkContext, ao as UNSAFE_createClientRoutes, ap as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, am as UNSAFE_getPatchRoutesOnNavigationFunction, aj as UNSAFE_hydrationRouteProperties, ak as UNSAFE_mapRouteProperties, aq as UNSAFE_shouldHydrateRouteLoader, an as UNSAFE_useFogOFWarDiscovery, ar as UNSAFE_useScrollRestoration, ab as URLSearchParamsInit, Q as createBrowserRouter, au as createCallServer, T as createHashRouter, o as createMemoryRouter, p as createRoutesFromChildren, q as createRoutesFromElements, ad as createSearchParams, aw as getServerStream, r as renderMatches, X as unstable_HistoryRouter, a6 as unstable_usePrompt, a5 as useBeforeUnload, a3 as useFetcher, a4 as useFetchers, a2 as useFormAction, $ as useLinkClickHandler, a0 as useSearchParams, a1 as useSubmit, a7 as useViewTransitionState } from './browser-
|
|
3
|
+
import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext, C as CriticalCss, S as ServerPayload } from './browser-Dpxu0wdb.js';
|
|
4
|
+
export { g as Await, b as AwaitProps, U as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, as as DecodeServerResponseFunction, at as EncodeActionFunction, w as FetcherFormProps, J as FetcherSubmitFunction, a8 as FetcherSubmitOptions, K as FetcherWithComponents, Z as Form, x as FormProps, V as HashRouter, H as HashRouterProps, s as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, W as Link, t as LinkProps, af as Links, h as MemoryRouter, M as MemoryRouterOpts, c as MemoryRouterProps, ae as Meta, Y as NavLink, u as NavLinkProps, v as NavLinkRenderProps, i as Navigate, N as NavigateProps, j as Outlet, O as OutletProps, a9 as ParamKeyValuePair, P as PathRouteProps, ah as PrefetchPageLinks, k as Route, d as RouteProps, l as Router, e as RouterProps, m as RouterProvider, R as RouterProviderProps, n as Routes, f as RoutesProps, ag as Scripts, ai as ScriptsProps, _ as ScrollRestoration, y as ScrollRestorationProps, av as ServerBrowserRouter, z as SetURLSearchParams, G as SubmitFunction, aa as SubmitOptions, ac as SubmitTarget, al as UNSAFE_FrameworkContext, ao as UNSAFE_createClientRoutes, ap as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, am as UNSAFE_getPatchRoutesOnNavigationFunction, aj as UNSAFE_hydrationRouteProperties, ak as UNSAFE_mapRouteProperties, aq as UNSAFE_shouldHydrateRouteLoader, an as UNSAFE_useFogOFWarDiscovery, ar as UNSAFE_useScrollRestoration, ab as URLSearchParamsInit, Q as createBrowserRouter, au as createCallServer, T as createHashRouter, o as createMemoryRouter, p as createRoutesFromChildren, q as createRoutesFromElements, ad as createSearchParams, aw as getServerStream, r as renderMatches, X as unstable_HistoryRouter, a6 as unstable_usePrompt, a5 as useBeforeUnload, a3 as useFetcher, a4 as useFetchers, a2 as useFormAction, $ as useLinkClickHandler, a0 as useSearchParams, a1 as useSubmit, a7 as useViewTransitionState } from './browser-Dpxu0wdb.js';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { ReactElement } from 'react';
|
|
7
7
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-0fd8a0272
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2695,8 +2695,7 @@ function createRouter(init) {
|
|
|
2695
2695
|
);
|
|
2696
2696
|
return { active: true, matches: fogMatches || [] };
|
|
2697
2697
|
} else {
|
|
2698
|
-
|
|
2699
|
-
if (Object.keys(matches[0].params).length > 0 || !lastRoute?.route.index && lastRoute?.route.path === "") {
|
|
2698
|
+
if (Object.keys(matches[0].params).length > 0) {
|
|
2700
2699
|
let partialMatches = matchRoutesImpl(
|
|
2701
2700
|
routesToUse,
|
|
2702
2701
|
pathname,
|
|
@@ -4195,7 +4194,7 @@ function getDataStrategyMatch(mapRouteProperties2, manifest, request, match, laz
|
|
|
4195
4194
|
return shouldRevalidateLoader(match, unstable_shouldRevalidateArgs);
|
|
4196
4195
|
},
|
|
4197
4196
|
resolve(handlerOverride) {
|
|
4198
|
-
if (isUsingNewApi || shouldLoad || handlerOverride && request.method
|
|
4197
|
+
if (isUsingNewApi || shouldLoad || handlerOverride && !isMutationMethod(request.method) && (match.route.lazy || match.route.loader)) {
|
|
4199
4198
|
return callLoaderOrAction({
|
|
4200
4199
|
request,
|
|
4201
4200
|
match,
|
|
@@ -6737,7 +6736,7 @@ async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, f
|
|
|
6737
6736
|
);
|
|
6738
6737
|
await Promise.all(routeDfds.map((d) => d.promise));
|
|
6739
6738
|
if ((!router.state.initialized || routesParams.size === 0) && !window.__reactRouterHdrActive) {
|
|
6740
|
-
singleFetchDfd.resolve({});
|
|
6739
|
+
singleFetchDfd.resolve({ routes: {} });
|
|
6741
6740
|
} else {
|
|
6742
6741
|
let targetRoutes = ssr && foundOptOutRoute && routesParams.size > 0 ? [...routesParams.keys()] : void 0;
|
|
6743
6742
|
try {
|
|
@@ -6894,12 +6893,14 @@ function unwrapSingleFetchResult(result, routeId) {
|
|
|
6894
6893
|
});
|
|
6895
6894
|
}
|
|
6896
6895
|
let routeResult = result.routes[routeId];
|
|
6897
|
-
if (
|
|
6896
|
+
if (!routeResult) {
|
|
6897
|
+
return void 0;
|
|
6898
|
+
} else if ("error" in routeResult) {
|
|
6898
6899
|
throw routeResult.error;
|
|
6899
6900
|
} else if ("data" in routeResult) {
|
|
6900
6901
|
return routeResult.data;
|
|
6901
6902
|
} else {
|
|
6902
|
-
throw new Error(`
|
|
6903
|
+
throw new Error(`Invalid response found for routeId "${routeId}"`);
|
|
6903
6904
|
}
|
|
6904
6905
|
}
|
|
6905
6906
|
function createDeferred2() {
|
|
@@ -8138,7 +8139,7 @@ function mergeRefs(...refs) {
|
|
|
8138
8139
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8139
8140
|
try {
|
|
8140
8141
|
if (isBrowser) {
|
|
8141
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8142
|
+
window.__reactRouterVersion = "0.0.0-experimental-0fd8a0272";
|
|
8142
8143
|
}
|
|
8143
8144
|
} catch (e) {
|
|
8144
8145
|
}
|
|
@@ -10863,11 +10864,9 @@ function createCallServer({
|
|
|
10863
10864
|
decode: decode2,
|
|
10864
10865
|
encodeAction
|
|
10865
10866
|
}) {
|
|
10866
|
-
let actionCounter = 0;
|
|
10867
10867
|
let landedActionId = 0;
|
|
10868
10868
|
return async (id, args) => {
|
|
10869
|
-
let actionId =
|
|
10870
|
-
const locationKey = window.__router.state.loaderData;
|
|
10869
|
+
let actionId = window.__routerActionID = (window.__routerActionID ?? (window.__routerActionID = 0)) + 1;
|
|
10871
10870
|
const response = await fetch(location.href, {
|
|
10872
10871
|
body: await encodeAction(args),
|
|
10873
10872
|
method: "POST",
|
|
@@ -10885,12 +10884,22 @@ function createCallServer({
|
|
|
10885
10884
|
}
|
|
10886
10885
|
if (payload.rerender) {
|
|
10887
10886
|
(async () => {
|
|
10888
|
-
const
|
|
10889
|
-
if (!
|
|
10890
|
-
if (
|
|
10887
|
+
const rerender = await payload.rerender;
|
|
10888
|
+
if (!rerender) return;
|
|
10889
|
+
if (landedActionId < actionId && window.__routerActionID <= actionId) {
|
|
10891
10890
|
landedActionId = actionId;
|
|
10891
|
+
if (rerender.type === "redirect") {
|
|
10892
|
+
if (rerender.reload) {
|
|
10893
|
+
window.location.href = rerender.location;
|
|
10894
|
+
return;
|
|
10895
|
+
}
|
|
10896
|
+
window.__router.navigate(rerender.location, {
|
|
10897
|
+
replace: rerender.replace
|
|
10898
|
+
});
|
|
10899
|
+
return;
|
|
10900
|
+
}
|
|
10892
10901
|
let lastMatch;
|
|
10893
|
-
for (const match of
|
|
10902
|
+
for (const match of rerender.matches) {
|
|
10894
10903
|
window.__router.patchRoutes(
|
|
10895
10904
|
lastMatch?.id ?? null,
|
|
10896
10905
|
[createRouteFromServerManifest(match)],
|
|
@@ -10898,17 +10907,18 @@ function createCallServer({
|
|
|
10898
10907
|
);
|
|
10899
10908
|
lastMatch = match;
|
|
10900
10909
|
}
|
|
10910
|
+
window.__router._internalSetStateDoNotUseOrYouWillBreakYourApp({});
|
|
10901
10911
|
React14.startTransition(() => {
|
|
10902
10912
|
window.__router._internalSetStateDoNotUseOrYouWillBreakYourApp({
|
|
10903
10913
|
loaderData: Object.assign(
|
|
10904
10914
|
{},
|
|
10905
10915
|
window.__router.state.loaderData,
|
|
10906
|
-
|
|
10916
|
+
rerender.loaderData
|
|
10907
10917
|
),
|
|
10908
|
-
errors:
|
|
10918
|
+
errors: rerender.errors ? Object.assign(
|
|
10909
10919
|
{},
|
|
10910
10920
|
window.__router.state.errors,
|
|
10911
|
-
|
|
10921
|
+
rerender.errors
|
|
10912
10922
|
) : null
|
|
10913
10923
|
});
|
|
10914
10924
|
});
|
|
@@ -10924,6 +10934,14 @@ function createRouterFromPayload({
|
|
|
10924
10934
|
}) {
|
|
10925
10935
|
if (window.__router) return window.__router;
|
|
10926
10936
|
if (payload.type !== "render") throw new Error("Invalid payload type");
|
|
10937
|
+
let patches = /* @__PURE__ */ new Map();
|
|
10938
|
+
payload.patches.forEach((patch) => {
|
|
10939
|
+
invariant(patch.parentId, "Invalid patch parentId");
|
|
10940
|
+
if (!patches.has(patch.parentId)) {
|
|
10941
|
+
patches.set(patch.parentId, []);
|
|
10942
|
+
}
|
|
10943
|
+
patches.get(patch.parentId)?.push(patch);
|
|
10944
|
+
});
|
|
10927
10945
|
let routes = payload.matches.reduceRight((previous, match) => {
|
|
10928
10946
|
const route = createRouteFromServerManifest(
|
|
10929
10947
|
match,
|
|
@@ -10931,6 +10949,12 @@ function createRouterFromPayload({
|
|
|
10931
10949
|
);
|
|
10932
10950
|
if (previous.length > 0) {
|
|
10933
10951
|
route.children = previous;
|
|
10952
|
+
let childrenToPatch = patches.get(match.id);
|
|
10953
|
+
if (childrenToPatch) {
|
|
10954
|
+
route.children.push(
|
|
10955
|
+
...childrenToPatch.map((r) => createRouteFromServerManifest(r))
|
|
10956
|
+
);
|
|
10957
|
+
}
|
|
10934
10958
|
}
|
|
10935
10959
|
return [route];
|
|
10936
10960
|
}, []);
|
|
@@ -10970,6 +10994,9 @@ function createRouterFromPayload({
|
|
|
10970
10994
|
createRouteFromServerManifest(match)
|
|
10971
10995
|
])
|
|
10972
10996
|
);
|
|
10997
|
+
payload2.patches.forEach((p) => {
|
|
10998
|
+
patch(p.parentId ?? null, [createRouteFromServerManifest(p)]);
|
|
10999
|
+
});
|
|
10973
11000
|
},
|
|
10974
11001
|
// FIXME: Pass `build.ssr` and `build.basename` into this function
|
|
10975
11002
|
dataStrategy: getRSCSingleFetchDataStrategy(
|
|
@@ -10985,6 +11012,12 @@ function createRouterFromPayload({
|
|
|
10985
11012
|
} else {
|
|
10986
11013
|
window.__routerInitialized = false;
|
|
10987
11014
|
}
|
|
11015
|
+
let lastLocationKey = window.__router.state.location.key;
|
|
11016
|
+
window.__router.subscribe(({ location: location2 }) => {
|
|
11017
|
+
if (location2.key !== lastLocationKey) {
|
|
11018
|
+
window.__routerActionID = (window.__routerActionID ?? (window.__routerActionID = 0)) + 1;
|
|
11019
|
+
}
|
|
11020
|
+
});
|
|
10988
11021
|
return window.__router;
|
|
10989
11022
|
}
|
|
10990
11023
|
var renderedRoutesContext = unstable_createContext();
|
|
@@ -11043,6 +11076,20 @@ function getFetchAndDecodeViaRSC(decode2) {
|
|
|
11043
11076
|
invariant(res.body, "No response body to decode");
|
|
11044
11077
|
try {
|
|
11045
11078
|
const payload = await decode2(res.body);
|
|
11079
|
+
if (payload.type === "redirect") {
|
|
11080
|
+
return {
|
|
11081
|
+
status: res.status,
|
|
11082
|
+
data: {
|
|
11083
|
+
redirect: {
|
|
11084
|
+
redirect: payload.location,
|
|
11085
|
+
reload: false,
|
|
11086
|
+
replace: payload.replace,
|
|
11087
|
+
revalidate: false,
|
|
11088
|
+
status: payload.status
|
|
11089
|
+
}
|
|
11090
|
+
}
|
|
11091
|
+
};
|
|
11092
|
+
}
|
|
11046
11093
|
if (payload.type !== "render") {
|
|
11047
11094
|
throw new Error("Unexpected payload type");
|
|
11048
11095
|
}
|
|
@@ -11144,7 +11191,11 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
11144
11191
|
} finally {
|
|
11145
11192
|
isHydrationRequest = false;
|
|
11146
11193
|
}
|
|
11147
|
-
} :
|
|
11194
|
+
} : (
|
|
11195
|
+
// We always make the call in this RSC world since even if we don't
|
|
11196
|
+
// have a `loader` we may need to get the `element` implementation
|
|
11197
|
+
(_, singleFetch) => callSingleFetch(singleFetch)
|
|
11198
|
+
),
|
|
11148
11199
|
action: match.clientAction ? (args, singleFetch) => match.clientAction({
|
|
11149
11200
|
...args,
|
|
11150
11201
|
serverAction: async () => {
|
|
@@ -11158,7 +11209,9 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
11158
11209
|
}) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : void 0,
|
|
11159
11210
|
path: match.path,
|
|
11160
11211
|
shouldRevalidate: match.shouldRevalidate,
|
|
11161
|
-
|
|
11212
|
+
// We always have a "loader" in this RSC world since even if we don't
|
|
11213
|
+
// have a `loader` we may need to get the `element` implementation
|
|
11214
|
+
hasLoader: true,
|
|
11162
11215
|
hasClientLoader: match.clientLoader != null,
|
|
11163
11216
|
hasAction: match.hasAction,
|
|
11164
11217
|
hasClientAction: match.clientAction != null,
|
|
@@ -11310,6 +11363,14 @@ async function routeServerRequest(request, requestServer, decode2, renderHTML) {
|
|
|
11310
11363
|
throw new Error("Failed to clone server response");
|
|
11311
11364
|
}
|
|
11312
11365
|
const payload = await decode2(serverResponse.body);
|
|
11366
|
+
if (payload.type === "redirect") {
|
|
11367
|
+
return new Response(null, {
|
|
11368
|
+
status: payload.status,
|
|
11369
|
+
headers: {
|
|
11370
|
+
Location: payload.location
|
|
11371
|
+
}
|
|
11372
|
+
});
|
|
11373
|
+
}
|
|
11313
11374
|
const html = await renderHTML(payload);
|
|
11314
11375
|
try {
|
|
11315
11376
|
const body = html.pipeThrough(injectRSCPayload(serverResponseB.body));
|