react-router 0.0.0-experimental-17b9b60af → 0.0.0-experimental-d82b9430b
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/{chunk-MV33LHGM.mjs → chunk-KBNUQA6K.mjs} +274 -1160
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.js +1 -2
- package/dist/development/dom-export.mjs +2 -3
- package/dist/development/index.d.mts +5 -16
- package/dist/development/index.d.ts +3 -92
- package/dist/development/index.js +272 -1164
- package/dist/development/index.mjs +2 -13
- package/dist/development/lib/types/internal.d.mts +1 -1
- 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/{browser-BM9EKN98.d.mts → lib-C1JSsICm.d.mts} +2 -80
- package/dist/{production/register-B0EYMBux.d.ts → development/register-DCE0tH5m.d.ts} +2 -13
- package/dist/{production/route-data-B3YkvRuy.d.mts → development/route-data-ByAYLHuM.d.mts} +2 -13
- package/dist/production/{chunk-6E4NX5TN.mjs → chunk-KAPQWN2R.mjs} +274 -1160
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.js +1 -2
- package/dist/production/dom-export.mjs +2 -3
- package/dist/production/index.d.mts +5 -16
- package/dist/production/index.d.ts +3 -92
- package/dist/production/index.js +272 -1164
- package/dist/production/index.mjs +2 -13
- package/dist/production/lib/types/internal.d.mts +1 -1
- 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/{browser-BM9EKN98.d.mts → lib-C1JSsICm.d.mts} +2 -80
- package/dist/{development/register-B0EYMBux.d.ts → production/register-DCE0tH5m.d.ts} +2 -13
- package/dist/{development/route-data-B3YkvRuy.d.mts → production/route-data-ByAYLHuM.d.mts} +2 -13
- package/package.json +2 -33
- package/dist/development/rsc-export.d.mts +0 -1797
- package/dist/development/rsc-export.d.ts +0 -1797
- package/dist/development/rsc-export.js +0 -2901
- package/dist/development/rsc-export.mjs +0 -2865
- package/dist/production/rsc-export.d.mts +0 -1797
- package/dist/production/rsc-export.d.ts +0 -1797
- package/dist/production/rsc-export.js +0 -2901
- package/dist/production/rsc-export.mjs +0 -2865
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-d82b9430b
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -45,19 +45,19 @@ function createMemoryHistory(options = {}) {
|
|
|
45
45
|
return entries[index];
|
|
46
46
|
}
|
|
47
47
|
function createMemoryLocation(to, state = null, key) {
|
|
48
|
-
let
|
|
48
|
+
let location = createLocation(
|
|
49
49
|
entries ? getCurrentLocation().pathname : "/",
|
|
50
50
|
to,
|
|
51
51
|
state,
|
|
52
52
|
key
|
|
53
53
|
);
|
|
54
54
|
warning(
|
|
55
|
-
|
|
55
|
+
location.pathname.charAt(0) === "/",
|
|
56
56
|
`relative pathnames are not supported in memory history: ${JSON.stringify(
|
|
57
57
|
to
|
|
58
58
|
)}`
|
|
59
59
|
);
|
|
60
|
-
return
|
|
60
|
+
return location;
|
|
61
61
|
}
|
|
62
62
|
function createHref2(to) {
|
|
63
63
|
return typeof to === "string" ? to : createPath(to);
|
|
@@ -168,9 +168,9 @@ function createHashHistory(options = {}) {
|
|
|
168
168
|
}
|
|
169
169
|
return href2 + "#" + (typeof to === "string" ? to : createPath(to));
|
|
170
170
|
}
|
|
171
|
-
function validateHashLocation(
|
|
171
|
+
function validateHashLocation(location, to) {
|
|
172
172
|
warning(
|
|
173
|
-
|
|
173
|
+
location.pathname.charAt(0) === "/",
|
|
174
174
|
`relative pathnames are not supported in hash history.push(${JSON.stringify(
|
|
175
175
|
to
|
|
176
176
|
)})`
|
|
@@ -200,15 +200,15 @@ function warning(cond, message) {
|
|
|
200
200
|
function createKey() {
|
|
201
201
|
return Math.random().toString(36).substring(2, 10);
|
|
202
202
|
}
|
|
203
|
-
function getHistoryState(
|
|
203
|
+
function getHistoryState(location, index) {
|
|
204
204
|
return {
|
|
205
|
-
usr:
|
|
206
|
-
key:
|
|
205
|
+
usr: location.state,
|
|
206
|
+
key: location.key,
|
|
207
207
|
idx: index
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
210
|
function createLocation(current, to, state = null, key) {
|
|
211
|
-
let
|
|
211
|
+
let location = {
|
|
212
212
|
pathname: typeof current === "string" ? current : current.pathname,
|
|
213
213
|
search: "",
|
|
214
214
|
hash: "",
|
|
@@ -220,7 +220,7 @@ function createLocation(current, to, state = null, key) {
|
|
|
220
220
|
// keep as is for the time being and just let any incoming keys take precedence
|
|
221
221
|
key: to && to.key || key || createKey()
|
|
222
222
|
};
|
|
223
|
-
return
|
|
223
|
+
return location;
|
|
224
224
|
}
|
|
225
225
|
function createPath({
|
|
226
226
|
pathname = "/",
|
|
@@ -277,11 +277,11 @@ function getUrlBasedHistory(getLocation, createHref2, validateLocation, options
|
|
|
277
277
|
}
|
|
278
278
|
function push(to, state) {
|
|
279
279
|
action = "PUSH" /* Push */;
|
|
280
|
-
let
|
|
281
|
-
if (validateLocation) validateLocation(
|
|
280
|
+
let location = createLocation(history.location, to, state);
|
|
281
|
+
if (validateLocation) validateLocation(location, to);
|
|
282
282
|
index = getIndex() + 1;
|
|
283
|
-
let historyState = getHistoryState(
|
|
284
|
-
let url = history.createHref(
|
|
283
|
+
let historyState = getHistoryState(location, index);
|
|
284
|
+
let url = history.createHref(location);
|
|
285
285
|
try {
|
|
286
286
|
globalHistory.pushState(historyState, "", url);
|
|
287
287
|
} catch (error) {
|
|
@@ -296,11 +296,11 @@ function getUrlBasedHistory(getLocation, createHref2, validateLocation, options
|
|
|
296
296
|
}
|
|
297
297
|
function replace2(to, state) {
|
|
298
298
|
action = "REPLACE" /* Replace */;
|
|
299
|
-
let
|
|
300
|
-
if (validateLocation) validateLocation(
|
|
299
|
+
let location = createLocation(history.location, to, state);
|
|
300
|
+
if (validateLocation) validateLocation(location, to);
|
|
301
301
|
index = getIndex();
|
|
302
|
-
let historyState = getHistoryState(
|
|
303
|
-
let url = history.createHref(
|
|
302
|
+
let historyState = getHistoryState(location, index);
|
|
303
|
+
let url = history.createHref(location);
|
|
304
304
|
globalHistory.replaceState(historyState, "", url);
|
|
305
305
|
if (v5Compat && listener) {
|
|
306
306
|
listener({ action, location: history.location, delta: 0 });
|
|
@@ -419,7 +419,7 @@ function isUnsupportedLazyRouteFunctionKey(key) {
|
|
|
419
419
|
function isIndexRoute(route) {
|
|
420
420
|
return route.index === true;
|
|
421
421
|
}
|
|
422
|
-
function convertRoutesToDataRoutes(routes, mapRouteProperties2, parentPath = [], manifest = {}
|
|
422
|
+
function convertRoutesToDataRoutes(routes, mapRouteProperties2, parentPath = [], manifest = {}) {
|
|
423
423
|
return routes.map((route, index) => {
|
|
424
424
|
let treePath = [...parentPath, String(index)];
|
|
425
425
|
let id = typeof route.id === "string" ? route.id : treePath.join("-");
|
|
@@ -428,7 +428,7 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties2, parentPath = [],
|
|
|
428
428
|
`Cannot specify children on an index route`
|
|
429
429
|
);
|
|
430
430
|
invariant(
|
|
431
|
-
|
|
431
|
+
!manifest[id],
|
|
432
432
|
`Found a route id collision on id "${id}". Route id's must be globally unique within Data Router usages`
|
|
433
433
|
);
|
|
434
434
|
if (isIndexRoute(route)) {
|
|
@@ -452,8 +452,7 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties2, parentPath = [],
|
|
|
452
452
|
route.children,
|
|
453
453
|
mapRouteProperties2,
|
|
454
454
|
treePath,
|
|
455
|
-
manifest
|
|
456
|
-
allowInPlaceMutations
|
|
455
|
+
manifest
|
|
457
456
|
);
|
|
458
457
|
}
|
|
459
458
|
return pathOrLayoutRoute;
|
|
@@ -464,8 +463,8 @@ function matchRoutes(routes, locationArg, basename = "/") {
|
|
|
464
463
|
return matchRoutesImpl(routes, locationArg, basename, false);
|
|
465
464
|
}
|
|
466
465
|
function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
|
|
467
|
-
let
|
|
468
|
-
let pathname = stripBasename(
|
|
466
|
+
let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
467
|
+
let pathname = stripBasename(location.pathname || "/", basename);
|
|
469
468
|
if (pathname == null) {
|
|
470
469
|
return null;
|
|
471
470
|
}
|
|
@@ -1073,7 +1072,7 @@ function createRouter(init) {
|
|
|
1073
1072
|
let pendingRevalidationDfd = null;
|
|
1074
1073
|
function initialize() {
|
|
1075
1074
|
unlistenHistory = init.history.listen(
|
|
1076
|
-
({ action: historyAction, location
|
|
1075
|
+
({ action: historyAction, location, delta }) => {
|
|
1077
1076
|
if (unblockBlockerHistoryUpdate) {
|
|
1078
1077
|
unblockBlockerHistoryUpdate();
|
|
1079
1078
|
unblockBlockerHistoryUpdate = void 0;
|
|
@@ -1085,7 +1084,7 @@ function createRouter(init) {
|
|
|
1085
1084
|
);
|
|
1086
1085
|
let blockerKey = shouldBlockNavigation({
|
|
1087
1086
|
currentLocation: state.location,
|
|
1088
|
-
nextLocation:
|
|
1087
|
+
nextLocation: location,
|
|
1089
1088
|
historyAction
|
|
1090
1089
|
});
|
|
1091
1090
|
if (blockerKey && delta != null) {
|
|
@@ -1095,13 +1094,13 @@ function createRouter(init) {
|
|
|
1095
1094
|
init.history.go(delta * -1);
|
|
1096
1095
|
updateBlocker(blockerKey, {
|
|
1097
1096
|
state: "blocked",
|
|
1098
|
-
location
|
|
1097
|
+
location,
|
|
1099
1098
|
proceed() {
|
|
1100
1099
|
updateBlocker(blockerKey, {
|
|
1101
1100
|
state: "proceeding",
|
|
1102
1101
|
proceed: void 0,
|
|
1103
1102
|
reset: void 0,
|
|
1104
|
-
location
|
|
1103
|
+
location
|
|
1105
1104
|
});
|
|
1106
1105
|
nextHistoryUpdatePromise.then(() => init.history.go(delta));
|
|
1107
1106
|
},
|
|
@@ -1113,7 +1112,7 @@ function createRouter(init) {
|
|
|
1113
1112
|
});
|
|
1114
1113
|
return;
|
|
1115
1114
|
}
|
|
1116
|
-
return startNavigation(historyAction,
|
|
1115
|
+
return startNavigation(historyAction, location);
|
|
1117
1116
|
}
|
|
1118
1117
|
);
|
|
1119
1118
|
if (isBrowser2) {
|
|
@@ -1146,19 +1145,6 @@ function createRouter(init) {
|
|
|
1146
1145
|
return () => subscribers.delete(fn);
|
|
1147
1146
|
}
|
|
1148
1147
|
function updateState(newState, opts = {}) {
|
|
1149
|
-
if (newState.matches) {
|
|
1150
|
-
newState.matches = newState.matches.map((m) => {
|
|
1151
|
-
let route = manifest[m.route.id];
|
|
1152
|
-
let matchRoute = m.route;
|
|
1153
|
-
if (matchRoute.element !== route.element || matchRoute.errorElement !== route.errorElement || matchRoute.hydrateFallbackElement !== route.hydrateFallbackElement) {
|
|
1154
|
-
return {
|
|
1155
|
-
...m,
|
|
1156
|
-
route
|
|
1157
|
-
};
|
|
1158
|
-
}
|
|
1159
|
-
return m;
|
|
1160
|
-
});
|
|
1161
|
-
}
|
|
1162
1148
|
state = {
|
|
1163
1149
|
...state,
|
|
1164
1150
|
...newState
|
|
@@ -1189,8 +1175,8 @@ function createRouter(init) {
|
|
|
1189
1175
|
unmountedFetchers.forEach((key) => deleteFetcher(key));
|
|
1190
1176
|
mountedFetchers.forEach((key) => state.fetchers.delete(key));
|
|
1191
1177
|
}
|
|
1192
|
-
function completeNavigation(
|
|
1193
|
-
let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === "loading" &&
|
|
1178
|
+
function completeNavigation(location, newState, { flushSync } = {}) {
|
|
1179
|
+
let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === "loading" && location.state?._isRedirect !== true;
|
|
1194
1180
|
let actionData;
|
|
1195
1181
|
if (newState.actionData) {
|
|
1196
1182
|
if (Object.keys(newState.actionData).length > 0) {
|
|
@@ -1214,7 +1200,7 @@ function createRouter(init) {
|
|
|
1214
1200
|
blockers = new Map(blockers);
|
|
1215
1201
|
blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER));
|
|
1216
1202
|
}
|
|
1217
|
-
let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) &&
|
|
1203
|
+
let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && location.state?._isRedirect !== true;
|
|
1218
1204
|
if (inFlightDataRoutes) {
|
|
1219
1205
|
dataRoutes = inFlightDataRoutes;
|
|
1220
1206
|
inFlightDataRoutes = void 0;
|
|
@@ -1222,35 +1208,35 @@ function createRouter(init) {
|
|
|
1222
1208
|
if (isUninterruptedRevalidation) {
|
|
1223
1209
|
} else if (pendingAction === "POP" /* Pop */) {
|
|
1224
1210
|
} else if (pendingAction === "PUSH" /* Push */) {
|
|
1225
|
-
init.history.push(
|
|
1211
|
+
init.history.push(location, location.state);
|
|
1226
1212
|
} else if (pendingAction === "REPLACE" /* Replace */) {
|
|
1227
|
-
init.history.replace(
|
|
1213
|
+
init.history.replace(location, location.state);
|
|
1228
1214
|
}
|
|
1229
1215
|
let viewTransitionOpts;
|
|
1230
1216
|
if (pendingAction === "POP" /* Pop */) {
|
|
1231
1217
|
let priorPaths = appliedViewTransitions.get(state.location.pathname);
|
|
1232
|
-
if (priorPaths && priorPaths.has(
|
|
1218
|
+
if (priorPaths && priorPaths.has(location.pathname)) {
|
|
1233
1219
|
viewTransitionOpts = {
|
|
1234
1220
|
currentLocation: state.location,
|
|
1235
|
-
nextLocation:
|
|
1221
|
+
nextLocation: location
|
|
1236
1222
|
};
|
|
1237
|
-
} else if (appliedViewTransitions.has(
|
|
1223
|
+
} else if (appliedViewTransitions.has(location.pathname)) {
|
|
1238
1224
|
viewTransitionOpts = {
|
|
1239
|
-
currentLocation:
|
|
1225
|
+
currentLocation: location,
|
|
1240
1226
|
nextLocation: state.location
|
|
1241
1227
|
};
|
|
1242
1228
|
}
|
|
1243
1229
|
} else if (pendingViewTransitionEnabled) {
|
|
1244
1230
|
let toPaths = appliedViewTransitions.get(state.location.pathname);
|
|
1245
1231
|
if (toPaths) {
|
|
1246
|
-
toPaths.add(
|
|
1232
|
+
toPaths.add(location.pathname);
|
|
1247
1233
|
} else {
|
|
1248
|
-
toPaths = /* @__PURE__ */ new Set([
|
|
1234
|
+
toPaths = /* @__PURE__ */ new Set([location.pathname]);
|
|
1249
1235
|
appliedViewTransitions.set(state.location.pathname, toPaths);
|
|
1250
1236
|
}
|
|
1251
1237
|
viewTransitionOpts = {
|
|
1252
1238
|
currentLocation: state.location,
|
|
1253
|
-
nextLocation:
|
|
1239
|
+
nextLocation: location
|
|
1254
1240
|
};
|
|
1255
1241
|
}
|
|
1256
1242
|
updateState(
|
|
@@ -1260,12 +1246,12 @@ function createRouter(init) {
|
|
|
1260
1246
|
actionData,
|
|
1261
1247
|
loaderData,
|
|
1262
1248
|
historyAction: pendingAction,
|
|
1263
|
-
location
|
|
1249
|
+
location,
|
|
1264
1250
|
initialized: true,
|
|
1265
1251
|
navigation: IDLE_NAVIGATION,
|
|
1266
1252
|
revalidation: "idle",
|
|
1267
1253
|
restoreScrollPosition: getSavedScrollPosition(
|
|
1268
|
-
|
|
1254
|
+
location,
|
|
1269
1255
|
newState.matches || state.matches
|
|
1270
1256
|
),
|
|
1271
1257
|
preventScrollReset,
|
|
@@ -1382,7 +1368,7 @@ function createRouter(init) {
|
|
|
1382
1368
|
);
|
|
1383
1369
|
return promise;
|
|
1384
1370
|
}
|
|
1385
|
-
async function startNavigation(historyAction,
|
|
1371
|
+
async function startNavigation(historyAction, location, opts) {
|
|
1386
1372
|
pendingNavigationController && pendingNavigationController.abort();
|
|
1387
1373
|
pendingNavigationController = null;
|
|
1388
1374
|
pendingAction = historyAction;
|
|
@@ -1395,22 +1381,22 @@ function createRouter(init) {
|
|
|
1395
1381
|
let matches = opts?.initialHydration && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ? (
|
|
1396
1382
|
// `matchRoutes()` has already been called if we're in here via `router.initialize()`
|
|
1397
1383
|
state.matches
|
|
1398
|
-
) : matchRoutes(routesToUse,
|
|
1384
|
+
) : matchRoutes(routesToUse, location, basename);
|
|
1399
1385
|
let flushSync = (opts && opts.flushSync) === true;
|
|
1400
|
-
if (matches && state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location,
|
|
1401
|
-
completeNavigation(
|
|
1386
|
+
if (matches && state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {
|
|
1387
|
+
completeNavigation(location, { matches }, { flushSync });
|
|
1402
1388
|
return;
|
|
1403
1389
|
}
|
|
1404
|
-
let fogOfWar = checkFogOfWar(matches, routesToUse,
|
|
1390
|
+
let fogOfWar = checkFogOfWar(matches, routesToUse, location.pathname);
|
|
1405
1391
|
if (fogOfWar.active && fogOfWar.matches) {
|
|
1406
1392
|
matches = fogOfWar.matches;
|
|
1407
1393
|
}
|
|
1408
1394
|
if (!matches) {
|
|
1409
1395
|
let { error, notFoundMatches, route } = handleNavigational404(
|
|
1410
|
-
|
|
1396
|
+
location.pathname
|
|
1411
1397
|
);
|
|
1412
1398
|
completeNavigation(
|
|
1413
|
-
|
|
1399
|
+
location,
|
|
1414
1400
|
{
|
|
1415
1401
|
matches: notFoundMatches,
|
|
1416
1402
|
loaderData: {},
|
|
@@ -1425,7 +1411,7 @@ function createRouter(init) {
|
|
|
1425
1411
|
pendingNavigationController = new AbortController();
|
|
1426
1412
|
let request = createClientSideRequest(
|
|
1427
1413
|
init.history,
|
|
1428
|
-
|
|
1414
|
+
location,
|
|
1429
1415
|
pendingNavigationController.signal,
|
|
1430
1416
|
opts && opts.submission
|
|
1431
1417
|
);
|
|
@@ -1441,7 +1427,7 @@ function createRouter(init) {
|
|
|
1441
1427
|
} else if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) {
|
|
1442
1428
|
let actionResult = await handleAction(
|
|
1443
1429
|
request,
|
|
1444
|
-
|
|
1430
|
+
location,
|
|
1445
1431
|
opts.submission,
|
|
1446
1432
|
matches,
|
|
1447
1433
|
scopedContext,
|
|
@@ -1456,7 +1442,7 @@ function createRouter(init) {
|
|
|
1456
1442
|
let [routeId, result] = actionResult.pendingActionResult;
|
|
1457
1443
|
if (isErrorResult(result) && isRouteErrorResponse(result.error) && result.error.status === 404) {
|
|
1458
1444
|
pendingNavigationController = null;
|
|
1459
|
-
completeNavigation(
|
|
1445
|
+
completeNavigation(location, {
|
|
1460
1446
|
matches: actionResult.matches,
|
|
1461
1447
|
loaderData: {},
|
|
1462
1448
|
errors: {
|
|
@@ -1468,7 +1454,7 @@ function createRouter(init) {
|
|
|
1468
1454
|
}
|
|
1469
1455
|
matches = actionResult.matches || matches;
|
|
1470
1456
|
pendingActionResult = actionResult.pendingActionResult;
|
|
1471
|
-
loadingNavigation = getLoadingNavigation(
|
|
1457
|
+
loadingNavigation = getLoadingNavigation(location, opts.submission);
|
|
1472
1458
|
flushSync = false;
|
|
1473
1459
|
fogOfWar.active = false;
|
|
1474
1460
|
request = createClientSideRequest(
|
|
@@ -1484,7 +1470,7 @@ function createRouter(init) {
|
|
|
1484
1470
|
errors
|
|
1485
1471
|
} = await handleLoaders(
|
|
1486
1472
|
request,
|
|
1487
|
-
|
|
1473
|
+
location,
|
|
1488
1474
|
matches,
|
|
1489
1475
|
scopedContext,
|
|
1490
1476
|
fogOfWar.active,
|
|
@@ -1500,21 +1486,21 @@ function createRouter(init) {
|
|
|
1500
1486
|
return;
|
|
1501
1487
|
}
|
|
1502
1488
|
pendingNavigationController = null;
|
|
1503
|
-
completeNavigation(
|
|
1489
|
+
completeNavigation(location, {
|
|
1504
1490
|
matches: updatedMatches || matches,
|
|
1505
1491
|
...getActionDataForCommit(pendingActionResult),
|
|
1506
1492
|
loaderData,
|
|
1507
1493
|
errors
|
|
1508
1494
|
});
|
|
1509
1495
|
}
|
|
1510
|
-
async function handleAction(request,
|
|
1496
|
+
async function handleAction(request, location, submission, matches, scopedContext, isFogOfWar, initialHydration, opts = {}) {
|
|
1511
1497
|
interruptActiveLoads();
|
|
1512
|
-
let navigation = getSubmittingNavigation(
|
|
1498
|
+
let navigation = getSubmittingNavigation(location, submission);
|
|
1513
1499
|
updateState({ navigation }, { flushSync: opts.flushSync === true });
|
|
1514
1500
|
if (isFogOfWar) {
|
|
1515
1501
|
let discoverResult = await discoverRoutes(
|
|
1516
1502
|
matches,
|
|
1517
|
-
|
|
1503
|
+
location.pathname,
|
|
1518
1504
|
request.signal
|
|
1519
1505
|
);
|
|
1520
1506
|
if (discoverResult.type === "aborted") {
|
|
@@ -1533,7 +1519,7 @@ function createRouter(init) {
|
|
|
1533
1519
|
};
|
|
1534
1520
|
} else if (!discoverResult.matches) {
|
|
1535
1521
|
let { notFoundMatches, error, route } = handleNavigational404(
|
|
1536
|
-
|
|
1522
|
+
location.pathname
|
|
1537
1523
|
);
|
|
1538
1524
|
return {
|
|
1539
1525
|
matches: notFoundMatches,
|
|
@@ -1550,13 +1536,13 @@ function createRouter(init) {
|
|
|
1550
1536
|
}
|
|
1551
1537
|
}
|
|
1552
1538
|
let result;
|
|
1553
|
-
let actionMatch = getTargetMatch(matches,
|
|
1539
|
+
let actionMatch = getTargetMatch(matches, location);
|
|
1554
1540
|
if (!actionMatch.route.action && !actionMatch.route.lazy) {
|
|
1555
1541
|
result = {
|
|
1556
1542
|
type: "error" /* error */,
|
|
1557
1543
|
error: getInternalRouterError(405, {
|
|
1558
1544
|
method: request.method,
|
|
1559
|
-
pathname:
|
|
1545
|
+
pathname: location.pathname,
|
|
1560
1546
|
routeId: actionMatch.route.id
|
|
1561
1547
|
})
|
|
1562
1548
|
};
|
|
@@ -1594,12 +1580,12 @@ function createRouter(init) {
|
|
|
1594
1580
|
if (opts && opts.replace != null) {
|
|
1595
1581
|
replace2 = opts.replace;
|
|
1596
1582
|
} else {
|
|
1597
|
-
let
|
|
1583
|
+
let location2 = normalizeRedirectLocation(
|
|
1598
1584
|
result.response.headers.get("Location"),
|
|
1599
1585
|
new URL(request.url),
|
|
1600
1586
|
basename
|
|
1601
1587
|
);
|
|
1602
|
-
replace2 =
|
|
1588
|
+
replace2 = location2 === state.location.pathname + state.location.search;
|
|
1603
1589
|
}
|
|
1604
1590
|
await startRedirectNavigation(request, result, true, {
|
|
1605
1591
|
submission,
|
|
@@ -1626,8 +1612,8 @@ function createRouter(init) {
|
|
|
1626
1612
|
pendingActionResult: [actionMatch.route.id, result]
|
|
1627
1613
|
};
|
|
1628
1614
|
}
|
|
1629
|
-
async function handleLoaders(request,
|
|
1630
|
-
let loadingNavigation = overrideNavigation || getLoadingNavigation(
|
|
1615
|
+
async function handleLoaders(request, location, matches, scopedContext, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace2, initialHydration, flushSync, pendingActionResult) {
|
|
1616
|
+
let loadingNavigation = overrideNavigation || getLoadingNavigation(location, submission);
|
|
1631
1617
|
let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);
|
|
1632
1618
|
let shouldUpdateNavigationState = !isUninterruptedRevalidation && !initialHydration;
|
|
1633
1619
|
if (isFogOfWar) {
|
|
@@ -1645,7 +1631,7 @@ function createRouter(init) {
|
|
|
1645
1631
|
}
|
|
1646
1632
|
let discoverResult = await discoverRoutes(
|
|
1647
1633
|
matches,
|
|
1648
|
-
|
|
1634
|
+
location.pathname,
|
|
1649
1635
|
request.signal
|
|
1650
1636
|
);
|
|
1651
1637
|
if (discoverResult.type === "aborted") {
|
|
@@ -1661,7 +1647,7 @@ function createRouter(init) {
|
|
|
1661
1647
|
};
|
|
1662
1648
|
} else if (!discoverResult.matches) {
|
|
1663
1649
|
let { error, notFoundMatches, route } = handleNavigational404(
|
|
1664
|
-
|
|
1650
|
+
location.pathname
|
|
1665
1651
|
);
|
|
1666
1652
|
return {
|
|
1667
1653
|
matches: notFoundMatches,
|
|
@@ -1684,7 +1670,7 @@ function createRouter(init) {
|
|
|
1684
1670
|
state,
|
|
1685
1671
|
matches,
|
|
1686
1672
|
activeSubmission,
|
|
1687
|
-
|
|
1673
|
+
location,
|
|
1688
1674
|
initialHydration ? [] : hydrationRouteProperties2,
|
|
1689
1675
|
initialHydration === true,
|
|
1690
1676
|
isRevalidationRequired,
|
|
@@ -1701,7 +1687,7 @@ function createRouter(init) {
|
|
|
1701
1687
|
if (!init.dataStrategy && !dsMatches.some((m) => m.shouldLoad) && revalidatingFetchers.length === 0) {
|
|
1702
1688
|
let updatedFetchers2 = markFetchRedirectsDone();
|
|
1703
1689
|
completeNavigation(
|
|
1704
|
-
|
|
1690
|
+
location,
|
|
1705
1691
|
{
|
|
1706
1692
|
matches,
|
|
1707
1693
|
loaderData: {},
|
|
@@ -2213,31 +2199,31 @@ function createRouter(init) {
|
|
|
2213
2199
|
if (redirect2.response.headers.has("X-Remix-Revalidate")) {
|
|
2214
2200
|
isRevalidationRequired = true;
|
|
2215
2201
|
}
|
|
2216
|
-
let
|
|
2217
|
-
invariant(
|
|
2218
|
-
|
|
2219
|
-
|
|
2202
|
+
let location = redirect2.response.headers.get("Location");
|
|
2203
|
+
invariant(location, "Expected a Location header on the redirect Response");
|
|
2204
|
+
location = normalizeRedirectLocation(
|
|
2205
|
+
location,
|
|
2220
2206
|
new URL(request.url),
|
|
2221
2207
|
basename
|
|
2222
2208
|
);
|
|
2223
|
-
let redirectLocation = createLocation(state.location,
|
|
2209
|
+
let redirectLocation = createLocation(state.location, location, {
|
|
2224
2210
|
_isRedirect: true
|
|
2225
2211
|
});
|
|
2226
2212
|
if (isBrowser2) {
|
|
2227
2213
|
let isDocumentReload = false;
|
|
2228
2214
|
if (redirect2.response.headers.has("X-Remix-Reload-Document")) {
|
|
2229
2215
|
isDocumentReload = true;
|
|
2230
|
-
} else if (ABSOLUTE_URL_REGEX.test(
|
|
2231
|
-
const url = createBrowserURLImpl(
|
|
2216
|
+
} else if (ABSOLUTE_URL_REGEX.test(location)) {
|
|
2217
|
+
const url = createBrowserURLImpl(location, true);
|
|
2232
2218
|
isDocumentReload = // Hard reload if it's an absolute URL to a new origin
|
|
2233
2219
|
url.origin !== routerWindow.location.origin || // Hard reload if it's an absolute URL that does not match our basename
|
|
2234
2220
|
stripBasename(url.pathname, basename) == null;
|
|
2235
2221
|
}
|
|
2236
2222
|
if (isDocumentReload) {
|
|
2237
2223
|
if (replace2) {
|
|
2238
|
-
routerWindow.location.replace(
|
|
2224
|
+
routerWindow.location.replace(location);
|
|
2239
2225
|
} else {
|
|
2240
|
-
routerWindow.location.assign(
|
|
2226
|
+
routerWindow.location.assign(location);
|
|
2241
2227
|
}
|
|
2242
2228
|
return;
|
|
2243
2229
|
}
|
|
@@ -2253,7 +2239,7 @@ function createRouter(init) {
|
|
|
2253
2239
|
await startNavigation(redirectNavigationType, redirectLocation, {
|
|
2254
2240
|
submission: {
|
|
2255
2241
|
...activeSubmission,
|
|
2256
|
-
formAction:
|
|
2242
|
+
formAction: location
|
|
2257
2243
|
},
|
|
2258
2244
|
// Preserve these flags across redirects
|
|
2259
2245
|
preventScrollReset: preventScrollReset || pendingPreventScrollReset,
|
|
@@ -2527,25 +2513,25 @@ function createRouter(init) {
|
|
|
2527
2513
|
getScrollRestorationKey2 = null;
|
|
2528
2514
|
};
|
|
2529
2515
|
}
|
|
2530
|
-
function getScrollKey(
|
|
2516
|
+
function getScrollKey(location, matches) {
|
|
2531
2517
|
if (getScrollRestorationKey2) {
|
|
2532
2518
|
let key = getScrollRestorationKey2(
|
|
2533
|
-
|
|
2519
|
+
location,
|
|
2534
2520
|
matches.map((m) => convertRouteMatchToUiMatch(m, state.loaderData))
|
|
2535
2521
|
);
|
|
2536
|
-
return key ||
|
|
2522
|
+
return key || location.key;
|
|
2537
2523
|
}
|
|
2538
|
-
return
|
|
2524
|
+
return location.key;
|
|
2539
2525
|
}
|
|
2540
|
-
function saveScrollPosition(
|
|
2526
|
+
function saveScrollPosition(location, matches) {
|
|
2541
2527
|
if (savedScrollPositions2 && getScrollPosition) {
|
|
2542
|
-
let key = getScrollKey(
|
|
2528
|
+
let key = getScrollKey(location, matches);
|
|
2543
2529
|
savedScrollPositions2[key] = getScrollPosition();
|
|
2544
2530
|
}
|
|
2545
2531
|
}
|
|
2546
|
-
function getSavedScrollPosition(
|
|
2532
|
+
function getSavedScrollPosition(location, matches) {
|
|
2547
2533
|
if (savedScrollPositions2) {
|
|
2548
|
-
let key = getScrollKey(
|
|
2534
|
+
let key = getScrollKey(location, matches);
|
|
2549
2535
|
let y = savedScrollPositions2[key];
|
|
2550
2536
|
if (typeof y === "number") {
|
|
2551
2537
|
return y;
|
|
@@ -2599,8 +2585,7 @@ function createRouter(init) {
|
|
|
2599
2585
|
children,
|
|
2600
2586
|
routesToUse,
|
|
2601
2587
|
localManifest,
|
|
2602
|
-
mapRouteProperties2
|
|
2603
|
-
false
|
|
2588
|
+
mapRouteProperties2
|
|
2604
2589
|
);
|
|
2605
2590
|
}
|
|
2606
2591
|
});
|
|
@@ -2641,7 +2626,7 @@ function createRouter(init) {
|
|
|
2641
2626
|
manifest
|
|
2642
2627
|
);
|
|
2643
2628
|
}
|
|
2644
|
-
function patchRoutes(routeId, children
|
|
2629
|
+
function patchRoutes(routeId, children) {
|
|
2645
2630
|
let isNonHMR = inFlightDataRoutes == null;
|
|
2646
2631
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
2647
2632
|
patchRoutesImpl(
|
|
@@ -2649,8 +2634,7 @@ function createRouter(init) {
|
|
|
2649
2634
|
children,
|
|
2650
2635
|
routesToUse,
|
|
2651
2636
|
manifest,
|
|
2652
|
-
mapRouteProperties2
|
|
2653
|
-
unstable_allowElementMutations
|
|
2637
|
+
mapRouteProperties2
|
|
2654
2638
|
);
|
|
2655
2639
|
if (isNonHMR) {
|
|
2656
2640
|
dataRoutes = [...dataRoutes];
|
|
@@ -2692,10 +2676,7 @@ function createRouter(init) {
|
|
|
2692
2676
|
_internalFetchControllers: fetchControllers,
|
|
2693
2677
|
// TODO: Remove setRoutes, it's temporary to avoid dealing with
|
|
2694
2678
|
// updating the tree while validating the update algorithm.
|
|
2695
|
-
_internalSetRoutes
|
|
2696
|
-
_internalSetStateDoNotUseOrYouWillBreakYourApp(newState) {
|
|
2697
|
-
updateState(newState);
|
|
2698
|
-
}
|
|
2679
|
+
_internalSetRoutes
|
|
2699
2680
|
};
|
|
2700
2681
|
return router;
|
|
2701
2682
|
}
|
|
@@ -2719,26 +2700,19 @@ function createStaticHandler(routes, opts) {
|
|
|
2719
2700
|
skipLoaderErrorBubbling,
|
|
2720
2701
|
skipRevalidation,
|
|
2721
2702
|
dataStrategy,
|
|
2722
|
-
unstable_stream: stream,
|
|
2723
2703
|
unstable_respond: respond
|
|
2724
2704
|
} = {}) {
|
|
2725
2705
|
let url = new URL(request.url);
|
|
2726
2706
|
let method = request.method;
|
|
2727
|
-
let
|
|
2728
|
-
let matches = matchRoutes(dataRoutes,
|
|
2707
|
+
let location = createLocation("", createPath(url), null, "default");
|
|
2708
|
+
let matches = matchRoutes(dataRoutes, location, basename);
|
|
2729
2709
|
requestContext = requestContext != null ? requestContext : new unstable_RouterContextProvider();
|
|
2730
|
-
let respondOrStreamStaticContext = (ctx) => {
|
|
2731
|
-
return stream ? stream(
|
|
2732
|
-
requestContext,
|
|
2733
|
-
() => Promise.resolve(ctx)
|
|
2734
|
-
) : respond ? respond(ctx) : void 0;
|
|
2735
|
-
};
|
|
2736
2710
|
if (!isValidMethod(method) && method !== "HEAD") {
|
|
2737
2711
|
let error = getInternalRouterError(405, { method });
|
|
2738
2712
|
let { matches: methodNotAllowedMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
2739
2713
|
let staticContext = {
|
|
2740
2714
|
basename,
|
|
2741
|
-
location
|
|
2715
|
+
location,
|
|
2742
2716
|
matches: methodNotAllowedMatches,
|
|
2743
2717
|
loaderData: {},
|
|
2744
2718
|
actionData: null,
|
|
@@ -2749,13 +2723,13 @@ function createStaticHandler(routes, opts) {
|
|
|
2749
2723
|
loaderHeaders: {},
|
|
2750
2724
|
actionHeaders: {}
|
|
2751
2725
|
};
|
|
2752
|
-
return
|
|
2726
|
+
return respond ? respond(staticContext) : staticContext;
|
|
2753
2727
|
} else if (!matches) {
|
|
2754
|
-
let error = getInternalRouterError(404, { pathname:
|
|
2728
|
+
let error = getInternalRouterError(404, { pathname: location.pathname });
|
|
2755
2729
|
let { matches: notFoundMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
2756
2730
|
let staticContext = {
|
|
2757
2731
|
basename,
|
|
2758
|
-
location
|
|
2732
|
+
location,
|
|
2759
2733
|
matches: notFoundMatches,
|
|
2760
2734
|
loaderData: {},
|
|
2761
2735
|
actionData: null,
|
|
@@ -2766,9 +2740,9 @@ function createStaticHandler(routes, opts) {
|
|
|
2766
2740
|
loaderHeaders: {},
|
|
2767
2741
|
actionHeaders: {}
|
|
2768
2742
|
};
|
|
2769
|
-
return
|
|
2743
|
+
return respond ? respond(staticContext) : staticContext;
|
|
2770
2744
|
}
|
|
2771
|
-
if (
|
|
2745
|
+
if (respond && matches.some(
|
|
2772
2746
|
(m) => m.route.unstable_middleware || typeof m.route.lazy === "object" && m.route.lazy.unstable_middleware
|
|
2773
2747
|
)) {
|
|
2774
2748
|
invariant(
|
|
@@ -2793,30 +2767,9 @@ function createStaticHandler(routes, opts) {
|
|
|
2793
2767
|
},
|
|
2794
2768
|
true,
|
|
2795
2769
|
async () => {
|
|
2796
|
-
if (stream) {
|
|
2797
|
-
let res2 = await stream(
|
|
2798
|
-
requestContext,
|
|
2799
|
-
async (revalidationRequest) => {
|
|
2800
|
-
let result3 = await queryImpl(
|
|
2801
|
-
revalidationRequest,
|
|
2802
|
-
location2,
|
|
2803
|
-
matches,
|
|
2804
|
-
requestContext,
|
|
2805
|
-
dataStrategy || null,
|
|
2806
|
-
skipLoaderErrorBubbling === true,
|
|
2807
|
-
null,
|
|
2808
|
-
filterMatchesToLoad || null,
|
|
2809
|
-
skipRevalidation === true
|
|
2810
|
-
);
|
|
2811
|
-
return isResponse(result3) ? result3 : { location: location2, basename, ...result3 };
|
|
2812
|
-
}
|
|
2813
|
-
);
|
|
2814
|
-
return res2;
|
|
2815
|
-
}
|
|
2816
|
-
invariant(respond, "Expected respond to be defined");
|
|
2817
2770
|
let result2 = await queryImpl(
|
|
2818
2771
|
request,
|
|
2819
|
-
|
|
2772
|
+
location,
|
|
2820
2773
|
matches,
|
|
2821
2774
|
requestContext,
|
|
2822
2775
|
dataStrategy || null,
|
|
@@ -2828,7 +2781,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2828
2781
|
if (isResponse(result2)) {
|
|
2829
2782
|
return result2;
|
|
2830
2783
|
}
|
|
2831
|
-
renderedStaticContext = { location
|
|
2784
|
+
renderedStaticContext = { location, basename, ...result2 };
|
|
2832
2785
|
let res = await respond(renderedStaticContext);
|
|
2833
2786
|
return res;
|
|
2834
2787
|
},
|
|
@@ -2840,13 +2793,14 @@ function createStaticHandler(routes, opts) {
|
|
|
2840
2793
|
if (routeId in renderedStaticContext.loaderData) {
|
|
2841
2794
|
renderedStaticContext.loaderData[routeId] = void 0;
|
|
2842
2795
|
}
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2796
|
+
return respond(
|
|
2797
|
+
getStaticContextFromError(
|
|
2798
|
+
dataRoutes,
|
|
2799
|
+
renderedStaticContext,
|
|
2800
|
+
error,
|
|
2801
|
+
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
2802
|
+
)
|
|
2848
2803
|
);
|
|
2849
|
-
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
2850
2804
|
} else {
|
|
2851
2805
|
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
2852
2806
|
matches,
|
|
@@ -2854,9 +2808,9 @@ function createStaticHandler(routes, opts) {
|
|
|
2854
2808
|
(m) => m.route.id === routeId || m.route.loader
|
|
2855
2809
|
)?.route.id || routeId
|
|
2856
2810
|
).route.id;
|
|
2857
|
-
|
|
2811
|
+
return respond({
|
|
2858
2812
|
matches,
|
|
2859
|
-
location
|
|
2813
|
+
location,
|
|
2860
2814
|
basename,
|
|
2861
2815
|
loaderData: {},
|
|
2862
2816
|
actionData: null,
|
|
@@ -2866,8 +2820,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2866
2820
|
statusCode: isRouteErrorResponse(error) ? error.status : 500,
|
|
2867
2821
|
actionHeaders: {},
|
|
2868
2822
|
loaderHeaders: {}
|
|
2869
|
-
};
|
|
2870
|
-
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
2823
|
+
});
|
|
2871
2824
|
}
|
|
2872
2825
|
}
|
|
2873
2826
|
);
|
|
@@ -2882,7 +2835,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2882
2835
|
}
|
|
2883
2836
|
let result = await queryImpl(
|
|
2884
2837
|
request,
|
|
2885
|
-
|
|
2838
|
+
location,
|
|
2886
2839
|
matches,
|
|
2887
2840
|
requestContext,
|
|
2888
2841
|
dataStrategy || null,
|
|
@@ -2894,7 +2847,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2894
2847
|
if (isResponse(result)) {
|
|
2895
2848
|
return result;
|
|
2896
2849
|
}
|
|
2897
|
-
return { location
|
|
2850
|
+
return { location, basename, ...result };
|
|
2898
2851
|
}
|
|
2899
2852
|
async function queryRoute(request, {
|
|
2900
2853
|
routeId,
|
|
@@ -2904,22 +2857,22 @@ function createStaticHandler(routes, opts) {
|
|
|
2904
2857
|
} = {}) {
|
|
2905
2858
|
let url = new URL(request.url);
|
|
2906
2859
|
let method = request.method;
|
|
2907
|
-
let
|
|
2908
|
-
let matches = matchRoutes(dataRoutes,
|
|
2860
|
+
let location = createLocation("", createPath(url), null, "default");
|
|
2861
|
+
let matches = matchRoutes(dataRoutes, location, basename);
|
|
2909
2862
|
requestContext = requestContext != null ? requestContext : new unstable_RouterContextProvider();
|
|
2910
2863
|
if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") {
|
|
2911
2864
|
throw getInternalRouterError(405, { method });
|
|
2912
2865
|
} else if (!matches) {
|
|
2913
|
-
throw getInternalRouterError(404, { pathname:
|
|
2866
|
+
throw getInternalRouterError(404, { pathname: location.pathname });
|
|
2914
2867
|
}
|
|
2915
|
-
let match = routeId ? matches.find((m) => m.route.id === routeId) : getTargetMatch(matches,
|
|
2868
|
+
let match = routeId ? matches.find((m) => m.route.id === routeId) : getTargetMatch(matches, location);
|
|
2916
2869
|
if (routeId && !match) {
|
|
2917
2870
|
throw getInternalRouterError(403, {
|
|
2918
|
-
pathname:
|
|
2871
|
+
pathname: location.pathname,
|
|
2919
2872
|
routeId
|
|
2920
2873
|
});
|
|
2921
2874
|
} else if (!match) {
|
|
2922
|
-
throw getInternalRouterError(404, { pathname:
|
|
2875
|
+
throw getInternalRouterError(404, { pathname: location.pathname });
|
|
2923
2876
|
}
|
|
2924
2877
|
if (respond && matches.some(
|
|
2925
2878
|
(m) => m.route.unstable_middleware || typeof m.route.lazy === "object" && m.route.lazy.unstable_middleware
|
|
@@ -2942,7 +2895,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2942
2895
|
async () => {
|
|
2943
2896
|
let result2 = await queryImpl(
|
|
2944
2897
|
request,
|
|
2945
|
-
|
|
2898
|
+
location,
|
|
2946
2899
|
matches,
|
|
2947
2900
|
requestContext,
|
|
2948
2901
|
dataStrategy || null,
|
|
@@ -2975,7 +2928,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2975
2928
|
}
|
|
2976
2929
|
let result = await queryImpl(
|
|
2977
2930
|
request,
|
|
2978
|
-
|
|
2931
|
+
location,
|
|
2979
2932
|
matches,
|
|
2980
2933
|
requestContext,
|
|
2981
2934
|
dataStrategy || null,
|
|
@@ -2999,7 +2952,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2999
2952
|
}
|
|
3000
2953
|
return void 0;
|
|
3001
2954
|
}
|
|
3002
|
-
async function queryImpl(request,
|
|
2955
|
+
async function queryImpl(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, skipRevalidation) {
|
|
3003
2956
|
invariant(
|
|
3004
2957
|
request.signal,
|
|
3005
2958
|
"query()/queryRoute() requests must contain an AbortController signal"
|
|
@@ -3009,7 +2962,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3009
2962
|
let result2 = await submit(
|
|
3010
2963
|
request,
|
|
3011
2964
|
matches,
|
|
3012
|
-
routeMatch || getTargetMatch(matches,
|
|
2965
|
+
routeMatch || getTargetMatch(matches, location),
|
|
3013
2966
|
requestContext,
|
|
3014
2967
|
dataStrategy,
|
|
3015
2968
|
skipLoaderErrorBubbling,
|
|
@@ -3325,7 +3278,7 @@ function throwStaticHandlerAbortedError(request, isRouteRequest) {
|
|
|
3325
3278
|
function isSubmissionNavigation(opts) {
|
|
3326
3279
|
return opts != null && ("formData" in opts && opts.formData != null || "body" in opts && opts.body !== void 0);
|
|
3327
3280
|
}
|
|
3328
|
-
function normalizeTo(
|
|
3281
|
+
function normalizeTo(location, matches, basename, to, fromRouteId, relative) {
|
|
3329
3282
|
let contextualMatches;
|
|
3330
3283
|
let activeRouteMatch;
|
|
3331
3284
|
if (fromRouteId) {
|
|
@@ -3344,12 +3297,12 @@ function normalizeTo(location2, matches, basename, to, fromRouteId, relative) {
|
|
|
3344
3297
|
let path = resolveTo(
|
|
3345
3298
|
to ? to : ".",
|
|
3346
3299
|
getResolveToMatches(contextualMatches),
|
|
3347
|
-
stripBasename(
|
|
3300
|
+
stripBasename(location.pathname, basename) || location.pathname,
|
|
3348
3301
|
relative === "path"
|
|
3349
3302
|
);
|
|
3350
3303
|
if (to == null) {
|
|
3351
|
-
path.search =
|
|
3352
|
-
path.hash =
|
|
3304
|
+
path.search = location.search;
|
|
3305
|
+
path.hash = location.hash;
|
|
3353
3306
|
}
|
|
3354
3307
|
if ((to == null || to === "" || to === ".") && activeRouteMatch) {
|
|
3355
3308
|
let nakedIndex = hasNakedIndexQuery(path.search);
|
|
@@ -3476,10 +3429,10 @@ function normalizeNavigateOptions(isFetcher, path, opts) {
|
|
|
3476
3429
|
parsedPath.search = `?${searchParams}`;
|
|
3477
3430
|
return { path: createPath(parsedPath), submission };
|
|
3478
3431
|
}
|
|
3479
|
-
function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest, history, state, matches, submission,
|
|
3432
|
+
function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest, history, state, matches, submission, location, lazyRoutePropertiesToSkip, initialHydration, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, hasPatchRoutesOnNavigation, pendingActionResult) {
|
|
3480
3433
|
let actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : void 0;
|
|
3481
3434
|
let currentUrl = history.createURL(state.location);
|
|
3482
|
-
let nextUrl = history.createURL(
|
|
3435
|
+
let nextUrl = history.createURL(location);
|
|
3483
3436
|
let maxIdx;
|
|
3484
3437
|
if (initialHydration && state.errors) {
|
|
3485
3438
|
let boundaryId = Object.keys(state.errors)[0];
|
|
@@ -3682,7 +3635,7 @@ function shouldRevalidateLoader(loaderMatch, arg) {
|
|
|
3682
3635
|
}
|
|
3683
3636
|
return arg.defaultShouldRevalidate;
|
|
3684
3637
|
}
|
|
3685
|
-
function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties2
|
|
3638
|
+
function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties2) {
|
|
3686
3639
|
let childrenToPatch;
|
|
3687
3640
|
if (routeId) {
|
|
3688
3641
|
let route = manifest[routeId];
|
|
@@ -3697,47 +3650,18 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
|
|
|
3697
3650
|
} else {
|
|
3698
3651
|
childrenToPatch = routesToUse;
|
|
3699
3652
|
}
|
|
3700
|
-
let uniqueChildren =
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
if (uniqueChildren.length > 0) {
|
|
3713
|
-
let newRoutes = convertRoutesToDataRoutes(
|
|
3714
|
-
uniqueChildren,
|
|
3715
|
-
mapRouteProperties2,
|
|
3716
|
-
[routeId || "_", "patch", String(childrenToPatch?.length || "0")],
|
|
3717
|
-
manifest
|
|
3718
|
-
);
|
|
3719
|
-
childrenToPatch.push(...newRoutes);
|
|
3720
|
-
}
|
|
3721
|
-
if (allowElementMutations && existingChildren.length > 0) {
|
|
3722
|
-
for (let i = 0; i < existingChildren.length; i++) {
|
|
3723
|
-
let { existingRoute, newRoute } = existingChildren[i];
|
|
3724
|
-
let existingRouteTyped = existingRoute;
|
|
3725
|
-
let [newRouteTyped] = convertRoutesToDataRoutes(
|
|
3726
|
-
[newRoute],
|
|
3727
|
-
mapRouteProperties2,
|
|
3728
|
-
[],
|
|
3729
|
-
// Doesn't matter for mutated routes since they already have an id
|
|
3730
|
-
{},
|
|
3731
|
-
// Don't touch the manifest here since we're updating in place
|
|
3732
|
-
true
|
|
3733
|
-
);
|
|
3734
|
-
Object.assign(existingRouteTyped, {
|
|
3735
|
-
element: newRouteTyped.element ? newRouteTyped.element : existingRouteTyped.element,
|
|
3736
|
-
errorElement: newRouteTyped.errorElement ? newRouteTyped.errorElement : existingRouteTyped.errorElement,
|
|
3737
|
-
hydrateFallbackElement: newRouteTyped.hydrateFallbackElement ? newRouteTyped.hydrateFallbackElement : existingRouteTyped.hydrateFallbackElement
|
|
3738
|
-
});
|
|
3739
|
-
}
|
|
3740
|
-
}
|
|
3653
|
+
let uniqueChildren = children.filter(
|
|
3654
|
+
(newRoute) => !childrenToPatch.some(
|
|
3655
|
+
(existingRoute) => isSameRoute(newRoute, existingRoute)
|
|
3656
|
+
)
|
|
3657
|
+
);
|
|
3658
|
+
let newRoutes = convertRoutesToDataRoutes(
|
|
3659
|
+
uniqueChildren,
|
|
3660
|
+
mapRouteProperties2,
|
|
3661
|
+
[routeId || "_", "patch", String(childrenToPatch?.length || "0")],
|
|
3662
|
+
manifest
|
|
3663
|
+
);
|
|
3664
|
+
childrenToPatch.push(...newRoutes);
|
|
3741
3665
|
}
|
|
3742
3666
|
function isSameRoute(newRoute, existingRoute) {
|
|
3743
3667
|
if ("id" in newRoute && "id" in existingRoute && newRoute.id === existingRoute.id) {
|
|
@@ -4086,7 +4010,7 @@ function getDataStrategyMatch(mapRouteProperties2, manifest, request, match, laz
|
|
|
4086
4010
|
return shouldRevalidateLoader(match, unstable_shouldRevalidateArgs);
|
|
4087
4011
|
},
|
|
4088
4012
|
resolve(handlerOverride) {
|
|
4089
|
-
if (isUsingNewApi || shouldLoad || handlerOverride &&
|
|
4013
|
+
if (isUsingNewApi || shouldLoad || handlerOverride && request.method === "GET" && (match.route.lazy || match.route.loader)) {
|
|
4090
4014
|
return callLoaderOrAction({
|
|
4091
4015
|
request,
|
|
4092
4016
|
match,
|
|
@@ -4346,39 +4270,39 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4346
4270
|
return { type: "data" /* data */, data: result };
|
|
4347
4271
|
}
|
|
4348
4272
|
function normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename) {
|
|
4349
|
-
let
|
|
4273
|
+
let location = response.headers.get("Location");
|
|
4350
4274
|
invariant(
|
|
4351
|
-
|
|
4275
|
+
location,
|
|
4352
4276
|
"Redirects returned/thrown from loaders/actions must have a Location header"
|
|
4353
4277
|
);
|
|
4354
|
-
if (!ABSOLUTE_URL_REGEX.test(
|
|
4278
|
+
if (!ABSOLUTE_URL_REGEX.test(location)) {
|
|
4355
4279
|
let trimmedMatches = matches.slice(
|
|
4356
4280
|
0,
|
|
4357
4281
|
matches.findIndex((m) => m.route.id === routeId) + 1
|
|
4358
4282
|
);
|
|
4359
|
-
|
|
4283
|
+
location = normalizeTo(
|
|
4360
4284
|
new URL(request.url),
|
|
4361
4285
|
trimmedMatches,
|
|
4362
4286
|
basename,
|
|
4363
|
-
|
|
4287
|
+
location
|
|
4364
4288
|
);
|
|
4365
|
-
response.headers.set("Location",
|
|
4289
|
+
response.headers.set("Location", location);
|
|
4366
4290
|
}
|
|
4367
4291
|
return response;
|
|
4368
4292
|
}
|
|
4369
|
-
function normalizeRedirectLocation(
|
|
4370
|
-
if (ABSOLUTE_URL_REGEX.test(
|
|
4371
|
-
let normalizedLocation =
|
|
4293
|
+
function normalizeRedirectLocation(location, currentUrl, basename) {
|
|
4294
|
+
if (ABSOLUTE_URL_REGEX.test(location)) {
|
|
4295
|
+
let normalizedLocation = location;
|
|
4372
4296
|
let url = normalizedLocation.startsWith("//") ? new URL(currentUrl.protocol + normalizedLocation) : new URL(normalizedLocation);
|
|
4373
4297
|
let isSameBasename = stripBasename(url.pathname, basename) != null;
|
|
4374
4298
|
if (url.origin === currentUrl.origin && isSameBasename) {
|
|
4375
4299
|
return url.pathname + url.search + url.hash;
|
|
4376
4300
|
}
|
|
4377
4301
|
}
|
|
4378
|
-
return
|
|
4302
|
+
return location;
|
|
4379
4303
|
}
|
|
4380
|
-
function createClientSideRequest(history,
|
|
4381
|
-
let url = history.createURL(stripHashFromPath(
|
|
4304
|
+
function createClientSideRequest(history, location, signal, submission) {
|
|
4305
|
+
let url = history.createURL(stripHashFromPath(location)).toString();
|
|
4382
4306
|
let init = { signal };
|
|
4383
4307
|
if (submission && isMutationMethod(submission.formMethod)) {
|
|
4384
4308
|
let { formMethod, formEncType } = submission;
|
|
@@ -4650,8 +4574,8 @@ function isMutationMethod(method) {
|
|
|
4650
4574
|
function hasNakedIndexQuery(search) {
|
|
4651
4575
|
return new URLSearchParams(search).getAll("index").some((v) => v === "");
|
|
4652
4576
|
}
|
|
4653
|
-
function getTargetMatch(matches,
|
|
4654
|
-
let search = typeof
|
|
4577
|
+
function getTargetMatch(matches, location) {
|
|
4578
|
+
let search = typeof location === "string" ? parsePath(location).search : location.search;
|
|
4655
4579
|
if (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || "")) {
|
|
4656
4580
|
return matches[matches.length - 1];
|
|
4657
4581
|
}
|
|
@@ -4692,11 +4616,11 @@ function getSubmissionFromNavigation(navigation) {
|
|
|
4692
4616
|
};
|
|
4693
4617
|
}
|
|
4694
4618
|
}
|
|
4695
|
-
function getLoadingNavigation(
|
|
4619
|
+
function getLoadingNavigation(location, submission) {
|
|
4696
4620
|
if (submission) {
|
|
4697
4621
|
let navigation = {
|
|
4698
4622
|
state: "loading",
|
|
4699
|
-
location
|
|
4623
|
+
location,
|
|
4700
4624
|
formMethod: submission.formMethod,
|
|
4701
4625
|
formAction: submission.formAction,
|
|
4702
4626
|
formEncType: submission.formEncType,
|
|
@@ -4708,7 +4632,7 @@ function getLoadingNavigation(location2, submission) {
|
|
|
4708
4632
|
} else {
|
|
4709
4633
|
let navigation = {
|
|
4710
4634
|
state: "loading",
|
|
4711
|
-
location
|
|
4635
|
+
location,
|
|
4712
4636
|
formMethod: void 0,
|
|
4713
4637
|
formAction: void 0,
|
|
4714
4638
|
formEncType: void 0,
|
|
@@ -4719,10 +4643,10 @@ function getLoadingNavigation(location2, submission) {
|
|
|
4719
4643
|
return navigation;
|
|
4720
4644
|
}
|
|
4721
4645
|
}
|
|
4722
|
-
function getSubmittingNavigation(
|
|
4646
|
+
function getSubmittingNavigation(location, submission) {
|
|
4723
4647
|
let navigation = {
|
|
4724
4648
|
state: "submitting",
|
|
4725
|
-
location
|
|
4649
|
+
location,
|
|
4726
4650
|
formMethod: submission.formMethod,
|
|
4727
4651
|
formAction: submission.formAction,
|
|
4728
4652
|
formEncType: submission.formEncType,
|
|
@@ -5048,18 +4972,18 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
5048
4972
|
);
|
|
5049
4973
|
}
|
|
5050
4974
|
let locationFromContext = useLocation();
|
|
5051
|
-
let
|
|
4975
|
+
let location;
|
|
5052
4976
|
if (locationArg) {
|
|
5053
4977
|
let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
5054
4978
|
invariant(
|
|
5055
4979
|
parentPathnameBase === "/" || parsedLocationArg.pathname?.startsWith(parentPathnameBase),
|
|
5056
4980
|
`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${parentPathnameBase}" but pathname "${parsedLocationArg.pathname}" was given in the \`location\` prop.`
|
|
5057
4981
|
);
|
|
5058
|
-
|
|
4982
|
+
location = parsedLocationArg;
|
|
5059
4983
|
} else {
|
|
5060
|
-
|
|
4984
|
+
location = locationFromContext;
|
|
5061
4985
|
}
|
|
5062
|
-
let pathname =
|
|
4986
|
+
let pathname = location.pathname || "/";
|
|
5063
4987
|
let remainingPathname = pathname;
|
|
5064
4988
|
if (parentPathnameBase !== "/") {
|
|
5065
4989
|
let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
|
|
@@ -5070,11 +4994,11 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
5070
4994
|
if (ENABLE_DEV_WARNINGS) {
|
|
5071
4995
|
warning(
|
|
5072
4996
|
parentRoute || matches != null,
|
|
5073
|
-
`No routes matched location "${
|
|
4997
|
+
`No routes matched location "${location.pathname}${location.search}${location.hash}" `
|
|
5074
4998
|
);
|
|
5075
4999
|
warning(
|
|
5076
5000
|
matches == null || matches[matches.length - 1].route.element !== void 0 || matches[matches.length - 1].route.Component !== void 0 || matches[matches.length - 1].route.lazy !== void 0,
|
|
5077
|
-
`Matched leaf route at location "${
|
|
5001
|
+
`Matched leaf route at location "${location.pathname}${location.search}${location.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`
|
|
5078
5002
|
);
|
|
5079
5003
|
}
|
|
5080
5004
|
let renderedMatches = _renderMatches(
|
|
@@ -5108,7 +5032,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
5108
5032
|
hash: "",
|
|
5109
5033
|
state: null,
|
|
5110
5034
|
key: "default",
|
|
5111
|
-
...
|
|
5035
|
+
...location
|
|
5112
5036
|
},
|
|
5113
5037
|
navigationType: "POP" /* Pop */
|
|
5114
5038
|
}
|
|
@@ -5276,7 +5200,6 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, fut
|
|
|
5276
5200
|
} else {
|
|
5277
5201
|
children = outlet;
|
|
5278
5202
|
}
|
|
5279
|
-
children = /* @__PURE__ */ React2.createElement(RedirectBoundary, null, children);
|
|
5280
5203
|
return /* @__PURE__ */ React2.createElement(
|
|
5281
5204
|
RenderedRoute,
|
|
5282
5205
|
{
|
|
@@ -5303,19 +5226,6 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, fut
|
|
|
5303
5226
|
) : getChildren();
|
|
5304
5227
|
}, null);
|
|
5305
5228
|
}
|
|
5306
|
-
var RedirectBoundary = class extends React2.Component {
|
|
5307
|
-
// If the error is Symbol.for("react-router.redirect"), keep rendering children.
|
|
5308
|
-
// If it's anything else, re-throw to bubble it up.
|
|
5309
|
-
static getDerivedStateFromError(error) {
|
|
5310
|
-
if (error === Symbol.for("react-router.redirect")) {
|
|
5311
|
-
return null;
|
|
5312
|
-
}
|
|
5313
|
-
throw error;
|
|
5314
|
-
}
|
|
5315
|
-
render() {
|
|
5316
|
-
return this.props.children;
|
|
5317
|
-
}
|
|
5318
|
-
};
|
|
5319
5229
|
function getDataRouterConsoleError(hookName) {
|
|
5320
5230
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
5321
5231
|
}
|
|
@@ -5884,9 +5794,9 @@ function Router({
|
|
|
5884
5794
|
}
|
|
5885
5795
|
function Routes({
|
|
5886
5796
|
children,
|
|
5887
|
-
location
|
|
5797
|
+
location
|
|
5888
5798
|
}) {
|
|
5889
|
-
return useRoutes(createRoutesFromChildren(children),
|
|
5799
|
+
return useRoutes(createRoutesFromChildren(children), location);
|
|
5890
5800
|
}
|
|
5891
5801
|
function Await({
|
|
5892
5802
|
children,
|
|
@@ -6310,7 +6220,7 @@ async function getKeyedPrefetchLinks(matches, manifest, routeModules) {
|
|
|
6310
6220
|
)
|
|
6311
6221
|
);
|
|
6312
6222
|
}
|
|
6313
|
-
function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest,
|
|
6223
|
+
function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, location, mode) {
|
|
6314
6224
|
let isNew = (match, index) => {
|
|
6315
6225
|
if (!currentMatches[index]) return true;
|
|
6316
6226
|
return match.route.id !== currentMatches[index].route.id;
|
|
@@ -6340,7 +6250,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
6340
6250
|
if (match.route.shouldRevalidate) {
|
|
6341
6251
|
let routeChoice = match.route.shouldRevalidate({
|
|
6342
6252
|
currentUrl: new URL(
|
|
6343
|
-
|
|
6253
|
+
location.pathname + location.search + location.hash,
|
|
6344
6254
|
window.origin
|
|
6345
6255
|
),
|
|
6346
6256
|
currentParams: currentMatches[0]?.params || {},
|
|
@@ -6970,7 +6880,7 @@ async function decodeDeferred(reader) {
|
|
|
6970
6880
|
}
|
|
6971
6881
|
function encode(input, options) {
|
|
6972
6882
|
const { plugins, postPlugins, signal } = options ?? {};
|
|
6973
|
-
const
|
|
6883
|
+
const encoder2 = {
|
|
6974
6884
|
deferred: {},
|
|
6975
6885
|
index: 0,
|
|
6976
6886
|
indices: /* @__PURE__ */ new Map(),
|
|
@@ -6983,7 +6893,7 @@ function encode(input, options) {
|
|
|
6983
6893
|
let lastSentIndex = 0;
|
|
6984
6894
|
const readable = new ReadableStream({
|
|
6985
6895
|
async start(controller) {
|
|
6986
|
-
const id = flatten.call(
|
|
6896
|
+
const id = flatten.call(encoder2, input);
|
|
6987
6897
|
if (Array.isArray(id)) {
|
|
6988
6898
|
throw new Error("This should never happen");
|
|
6989
6899
|
}
|
|
@@ -6992,13 +6902,13 @@ function encode(input, options) {
|
|
|
6992
6902
|
`));
|
|
6993
6903
|
} else {
|
|
6994
6904
|
controller.enqueue(
|
|
6995
|
-
textEncoder.encode(`[${
|
|
6905
|
+
textEncoder.encode(`[${encoder2.stringified.join(",")}]
|
|
6996
6906
|
`)
|
|
6997
6907
|
);
|
|
6998
|
-
lastSentIndex =
|
|
6908
|
+
lastSentIndex = encoder2.stringified.length - 1;
|
|
6999
6909
|
}
|
|
7000
6910
|
const seenPromises = /* @__PURE__ */ new WeakSet();
|
|
7001
|
-
if (Object.keys(
|
|
6911
|
+
if (Object.keys(encoder2.deferred).length) {
|
|
7002
6912
|
let raceDone;
|
|
7003
6913
|
const racePromise = new Promise((resolve, reject) => {
|
|
7004
6914
|
raceDone = resolve;
|
|
@@ -7013,19 +6923,19 @@ function encode(input, options) {
|
|
|
7013
6923
|
}
|
|
7014
6924
|
}
|
|
7015
6925
|
});
|
|
7016
|
-
while (Object.keys(
|
|
6926
|
+
while (Object.keys(encoder2.deferred).length > 0) {
|
|
7017
6927
|
for (const [deferredId, deferred] of Object.entries(
|
|
7018
|
-
|
|
6928
|
+
encoder2.deferred
|
|
7019
6929
|
)) {
|
|
7020
6930
|
if (seenPromises.has(deferred)) continue;
|
|
7021
6931
|
seenPromises.add(
|
|
7022
6932
|
// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
|
|
7023
|
-
|
|
6933
|
+
encoder2.deferred[Number(deferredId)] = Promise.race([
|
|
7024
6934
|
racePromise,
|
|
7025
6935
|
deferred
|
|
7026
6936
|
]).then(
|
|
7027
6937
|
(resolved) => {
|
|
7028
|
-
const id2 = flatten.call(
|
|
6938
|
+
const id2 = flatten.call(encoder2, resolved);
|
|
7029
6939
|
if (Array.isArray(id2)) {
|
|
7030
6940
|
controller.enqueue(
|
|
7031
6941
|
textEncoder.encode(
|
|
@@ -7033,7 +6943,7 @@ function encode(input, options) {
|
|
|
7033
6943
|
`
|
|
7034
6944
|
)
|
|
7035
6945
|
);
|
|
7036
|
-
|
|
6946
|
+
encoder2.index++;
|
|
7037
6947
|
lastSentIndex++;
|
|
7038
6948
|
} else if (id2 < 0) {
|
|
7039
6949
|
controller.enqueue(
|
|
@@ -7043,21 +6953,21 @@ function encode(input, options) {
|
|
|
7043
6953
|
)
|
|
7044
6954
|
);
|
|
7045
6955
|
} else {
|
|
7046
|
-
const values =
|
|
6956
|
+
const values = encoder2.stringified.slice(lastSentIndex + 1).join(",");
|
|
7047
6957
|
controller.enqueue(
|
|
7048
6958
|
textEncoder.encode(
|
|
7049
6959
|
`${TYPE_PROMISE}${deferredId}:[${values}]
|
|
7050
6960
|
`
|
|
7051
6961
|
)
|
|
7052
6962
|
);
|
|
7053
|
-
lastSentIndex =
|
|
6963
|
+
lastSentIndex = encoder2.stringified.length - 1;
|
|
7054
6964
|
}
|
|
7055
6965
|
},
|
|
7056
6966
|
(reason) => {
|
|
7057
6967
|
if (!reason || typeof reason !== "object" || !(reason instanceof Error)) {
|
|
7058
6968
|
reason = new Error("An unknown error occurred");
|
|
7059
6969
|
}
|
|
7060
|
-
const id2 = flatten.call(
|
|
6970
|
+
const id2 = flatten.call(encoder2, reason);
|
|
7061
6971
|
if (Array.isArray(id2)) {
|
|
7062
6972
|
controller.enqueue(
|
|
7063
6973
|
textEncoder.encode(
|
|
@@ -7065,7 +6975,7 @@ function encode(input, options) {
|
|
|
7065
6975
|
`
|
|
7066
6976
|
)
|
|
7067
6977
|
);
|
|
7068
|
-
|
|
6978
|
+
encoder2.index++;
|
|
7069
6979
|
lastSentIndex++;
|
|
7070
6980
|
} else if (id2 < 0) {
|
|
7071
6981
|
controller.enqueue(
|
|
@@ -7073,26 +6983,26 @@ function encode(input, options) {
|
|
|
7073
6983
|
`)
|
|
7074
6984
|
);
|
|
7075
6985
|
} else {
|
|
7076
|
-
const values =
|
|
6986
|
+
const values = encoder2.stringified.slice(lastSentIndex + 1).join(",");
|
|
7077
6987
|
controller.enqueue(
|
|
7078
6988
|
textEncoder.encode(
|
|
7079
6989
|
`${TYPE_ERROR}${deferredId}:[${values}]
|
|
7080
6990
|
`
|
|
7081
6991
|
)
|
|
7082
6992
|
);
|
|
7083
|
-
lastSentIndex =
|
|
6993
|
+
lastSentIndex = encoder2.stringified.length - 1;
|
|
7084
6994
|
}
|
|
7085
6995
|
}
|
|
7086
6996
|
).finally(() => {
|
|
7087
|
-
delete
|
|
6997
|
+
delete encoder2.deferred[Number(deferredId)];
|
|
7088
6998
|
})
|
|
7089
6999
|
);
|
|
7090
7000
|
}
|
|
7091
|
-
await Promise.race(Object.values(
|
|
7001
|
+
await Promise.race(Object.values(encoder2.deferred));
|
|
7092
7002
|
}
|
|
7093
7003
|
raceDone();
|
|
7094
7004
|
}
|
|
7095
|
-
await Promise.all(Object.values(
|
|
7005
|
+
await Promise.all(Object.values(encoder2.deferred));
|
|
7096
7006
|
controller.close();
|
|
7097
7007
|
}
|
|
7098
7008
|
});
|
|
@@ -7211,7 +7121,7 @@ function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules
|
|
|
7211
7121
|
);
|
|
7212
7122
|
return async (args) => args.unstable_runClientMiddleware(dataStrategy);
|
|
7213
7123
|
}
|
|
7214
|
-
function getSingleFetchDataStrategyImpl(getRouter, getRouteInfo, fetchAndDecode, ssr, basename
|
|
7124
|
+
function getSingleFetchDataStrategyImpl(getRouter, getRouteInfo, fetchAndDecode, ssr, basename) {
|
|
7215
7125
|
return async (args) => {
|
|
7216
7126
|
let { request, matches, fetcherKey } = args;
|
|
7217
7127
|
let router = getRouter();
|
|
@@ -7234,8 +7144,7 @@ function getSingleFetchDataStrategyImpl(getRouter, getRouteInfo, fetchAndDecode,
|
|
|
7234
7144
|
getRouteInfo,
|
|
7235
7145
|
fetchAndDecode,
|
|
7236
7146
|
ssr,
|
|
7237
|
-
basename
|
|
7238
|
-
shouldAllowOptOut
|
|
7147
|
+
basename
|
|
7239
7148
|
);
|
|
7240
7149
|
};
|
|
7241
7150
|
}
|
|
@@ -7287,7 +7196,7 @@ async function nonSsrStrategy(args, getRouteInfo, fetchAndDecode, basename) {
|
|
|
7287
7196
|
);
|
|
7288
7197
|
return results;
|
|
7289
7198
|
}
|
|
7290
|
-
async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, fetchAndDecode, ssr, basename
|
|
7199
|
+
async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, fetchAndDecode, ssr, basename) {
|
|
7291
7200
|
let routesParams = /* @__PURE__ */ new Set();
|
|
7292
7201
|
let foundOptOutRoute = false;
|
|
7293
7202
|
let routeDfds = args.matches.map(() => createDeferred2());
|
|
@@ -7307,7 +7216,7 @@ async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, f
|
|
|
7307
7216
|
hasShouldRevalidate === true);
|
|
7308
7217
|
return;
|
|
7309
7218
|
}
|
|
7310
|
-
if (
|
|
7219
|
+
if (hasClientLoader) {
|
|
7311
7220
|
if (hasLoader) {
|
|
7312
7221
|
foundOptOutRoute = true;
|
|
7313
7222
|
}
|
|
@@ -7410,7 +7319,7 @@ function stripIndexParam(url) {
|
|
|
7410
7319
|
}
|
|
7411
7320
|
return url;
|
|
7412
7321
|
}
|
|
7413
|
-
function singleFetchUrl(reqUrl, basename
|
|
7322
|
+
function singleFetchUrl(reqUrl, basename) {
|
|
7414
7323
|
let url = typeof reqUrl === "string" ? new URL(
|
|
7415
7324
|
reqUrl,
|
|
7416
7325
|
// This can be called during the SSR flow via PrefetchPageLinksImpl so
|
|
@@ -7418,17 +7327,17 @@ function singleFetchUrl(reqUrl, basename, extension) {
|
|
|
7418
7327
|
typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
|
|
7419
7328
|
) : reqUrl;
|
|
7420
7329
|
if (url.pathname === "/") {
|
|
7421
|
-
url.pathname =
|
|
7330
|
+
url.pathname = "_root.data";
|
|
7422
7331
|
} else if (basename && stripBasename(url.pathname, basename) === "/") {
|
|
7423
|
-
url.pathname = `${basename.replace(/\/$/, "")}/_root
|
|
7332
|
+
url.pathname = `${basename.replace(/\/$/, "")}/_root.data`;
|
|
7424
7333
|
} else {
|
|
7425
|
-
url.pathname = `${url.pathname.replace(/\/$/, "")}
|
|
7334
|
+
url.pathname = `${url.pathname.replace(/\/$/, "")}.data`;
|
|
7426
7335
|
}
|
|
7427
7336
|
return url;
|
|
7428
7337
|
}
|
|
7429
7338
|
async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
|
|
7430
7339
|
let { request } = args;
|
|
7431
|
-
let url = singleFetchUrl(request.url, basename
|
|
7340
|
+
let url = singleFetchUrl(request.url, basename);
|
|
7432
7341
|
if (request.method === "GET") {
|
|
7433
7342
|
url = stripIndexParam(url);
|
|
7434
7343
|
if (targetRoutes) {
|
|
@@ -7525,13 +7434,13 @@ function decodeViaTurboStream(body, global2) {
|
|
|
7525
7434
|
function unwrapSingleFetchResult(result, routeId) {
|
|
7526
7435
|
if ("redirect" in result) {
|
|
7527
7436
|
let {
|
|
7528
|
-
redirect:
|
|
7437
|
+
redirect: location,
|
|
7529
7438
|
revalidate,
|
|
7530
7439
|
reload,
|
|
7531
7440
|
replace: replace2,
|
|
7532
7441
|
status
|
|
7533
7442
|
} = result.redirect;
|
|
7534
|
-
throw redirect(
|
|
7443
|
+
throw redirect(location, {
|
|
7535
7444
|
status,
|
|
7536
7445
|
headers: {
|
|
7537
7446
|
// Three R's of redirecting (lol Veep)
|
|
@@ -8462,7 +8371,7 @@ function PrefetchPageLinksImpl({
|
|
|
8462
8371
|
matches: nextMatches,
|
|
8463
8372
|
...linkProps
|
|
8464
8373
|
}) {
|
|
8465
|
-
let
|
|
8374
|
+
let location = useLocation();
|
|
8466
8375
|
let { manifest, routeModules } = useFrameworkContext();
|
|
8467
8376
|
let { basename } = useDataRouterContext2();
|
|
8468
8377
|
let { loaderData, matches } = useDataRouterStateContext();
|
|
@@ -8472,10 +8381,10 @@ function PrefetchPageLinksImpl({
|
|
|
8472
8381
|
nextMatches,
|
|
8473
8382
|
matches,
|
|
8474
8383
|
manifest,
|
|
8475
|
-
|
|
8384
|
+
location,
|
|
8476
8385
|
"data"
|
|
8477
8386
|
),
|
|
8478
|
-
[page, nextMatches, matches, manifest,
|
|
8387
|
+
[page, nextMatches, matches, manifest, location]
|
|
8479
8388
|
);
|
|
8480
8389
|
let newMatchesForAssets = React9.useMemo(
|
|
8481
8390
|
() => getNewMatchesForLinks(
|
|
@@ -8483,13 +8392,13 @@ function PrefetchPageLinksImpl({
|
|
|
8483
8392
|
nextMatches,
|
|
8484
8393
|
matches,
|
|
8485
8394
|
manifest,
|
|
8486
|
-
|
|
8395
|
+
location,
|
|
8487
8396
|
"assets"
|
|
8488
8397
|
),
|
|
8489
|
-
[page, nextMatches, matches, manifest,
|
|
8398
|
+
[page, nextMatches, matches, manifest, location]
|
|
8490
8399
|
);
|
|
8491
8400
|
let dataHrefs = React9.useMemo(() => {
|
|
8492
|
-
if (page ===
|
|
8401
|
+
if (page === location.pathname + location.search + location.hash) {
|
|
8493
8402
|
return [];
|
|
8494
8403
|
}
|
|
8495
8404
|
let routesParams = /* @__PURE__ */ new Set();
|
|
@@ -8510,7 +8419,7 @@ function PrefetchPageLinksImpl({
|
|
|
8510
8419
|
if (routesParams.size === 0) {
|
|
8511
8420
|
return [];
|
|
8512
8421
|
}
|
|
8513
|
-
let url = singleFetchUrl(page, basename
|
|
8422
|
+
let url = singleFetchUrl(page, basename);
|
|
8514
8423
|
if (foundOptOutRoute && routesParams.size > 0) {
|
|
8515
8424
|
url.searchParams.set(
|
|
8516
8425
|
"_routes",
|
|
@@ -8521,7 +8430,7 @@ function PrefetchPageLinksImpl({
|
|
|
8521
8430
|
}, [
|
|
8522
8431
|
basename,
|
|
8523
8432
|
loaderData,
|
|
8524
|
-
|
|
8433
|
+
location,
|
|
8525
8434
|
manifest,
|
|
8526
8435
|
newMatchesForData,
|
|
8527
8436
|
nextMatches,
|
|
@@ -8546,7 +8455,7 @@ function Meta() {
|
|
|
8546
8455
|
matches: routerMatches,
|
|
8547
8456
|
loaderData
|
|
8548
8457
|
} = useDataRouterStateContext();
|
|
8549
|
-
let
|
|
8458
|
+
let location = useLocation();
|
|
8550
8459
|
let _matches = getActiveMatches(routerMatches, errors, isSpaMode);
|
|
8551
8460
|
let error = null;
|
|
8552
8461
|
if (errors) {
|
|
@@ -8576,7 +8485,7 @@ function Meta() {
|
|
|
8576
8485
|
routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
|
|
8577
8486
|
data: data2,
|
|
8578
8487
|
params,
|
|
8579
|
-
location
|
|
8488
|
+
location,
|
|
8580
8489
|
matches,
|
|
8581
8490
|
error
|
|
8582
8491
|
}) : Array.isArray(routeModule.meta) ? [...routeModule.meta] : routeModule.meta;
|
|
@@ -8808,7 +8717,7 @@ function mergeRefs(...refs) {
|
|
|
8808
8717
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8809
8718
|
try {
|
|
8810
8719
|
if (isBrowser) {
|
|
8811
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8720
|
+
window.__reactRouterVersion = "0.0.0-experimental-d82b9430b";
|
|
8812
8721
|
}
|
|
8813
8722
|
} catch (e) {
|
|
8814
8723
|
}
|
|
@@ -9066,14 +8975,14 @@ var NavLink = React10.forwardRef(
|
|
|
9066
8975
|
...rest
|
|
9067
8976
|
}, ref) {
|
|
9068
8977
|
let path = useResolvedPath(to, { relative: rest.relative });
|
|
9069
|
-
let
|
|
8978
|
+
let location = useLocation();
|
|
9070
8979
|
let routerState = React10.useContext(DataRouterStateContext);
|
|
9071
8980
|
let { navigator, basename } = React10.useContext(NavigationContext);
|
|
9072
8981
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
9073
8982
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
9074
8983
|
useViewTransitionState(path) && viewTransition === true;
|
|
9075
8984
|
let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
|
|
9076
|
-
let locationPathname =
|
|
8985
|
+
let locationPathname = location.pathname;
|
|
9077
8986
|
let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
|
|
9078
8987
|
if (!caseSensitive) {
|
|
9079
8988
|
locationPathname = locationPathname.toLowerCase();
|
|
@@ -9178,19 +9087,19 @@ function ScrollRestoration({
|
|
|
9178
9087
|
}) {
|
|
9179
9088
|
let remixContext = React10.useContext(FrameworkContext);
|
|
9180
9089
|
let { basename } = React10.useContext(NavigationContext);
|
|
9181
|
-
let
|
|
9090
|
+
let location = useLocation();
|
|
9182
9091
|
let matches = useMatches();
|
|
9183
9092
|
useScrollRestoration({ getKey, storageKey });
|
|
9184
9093
|
let ssrKey = React10.useMemo(
|
|
9185
9094
|
() => {
|
|
9186
9095
|
if (!remixContext || !getKey) return null;
|
|
9187
9096
|
let userKey = getScrollRestorationKey(
|
|
9188
|
-
|
|
9097
|
+
location,
|
|
9189
9098
|
matches,
|
|
9190
9099
|
basename,
|
|
9191
9100
|
getKey
|
|
9192
9101
|
);
|
|
9193
|
-
return userKey !==
|
|
9102
|
+
return userKey !== location.key ? userKey : null;
|
|
9194
9103
|
},
|
|
9195
9104
|
// Nah, we only need this the first time for the SSR render
|
|
9196
9105
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -9251,13 +9160,13 @@ function useLinkClickHandler(to, {
|
|
|
9251
9160
|
viewTransition
|
|
9252
9161
|
} = {}) {
|
|
9253
9162
|
let navigate = useNavigate();
|
|
9254
|
-
let
|
|
9163
|
+
let location = useLocation();
|
|
9255
9164
|
let path = useResolvedPath(to, { relative });
|
|
9256
9165
|
return React10.useCallback(
|
|
9257
9166
|
(event) => {
|
|
9258
9167
|
if (shouldProcessLinkClick(event, target)) {
|
|
9259
9168
|
event.preventDefault();
|
|
9260
|
-
let replace2 = replaceProp !== void 0 ? replaceProp : createPath(
|
|
9169
|
+
let replace2 = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
|
|
9261
9170
|
navigate(to, {
|
|
9262
9171
|
replace: replace2,
|
|
9263
9172
|
state,
|
|
@@ -9268,7 +9177,7 @@ function useLinkClickHandler(to, {
|
|
|
9268
9177
|
}
|
|
9269
9178
|
},
|
|
9270
9179
|
[
|
|
9271
|
-
|
|
9180
|
+
location,
|
|
9272
9181
|
navigate,
|
|
9273
9182
|
path,
|
|
9274
9183
|
replaceProp,
|
|
@@ -9288,18 +9197,18 @@ function useSearchParams(defaultInit) {
|
|
|
9288
9197
|
);
|
|
9289
9198
|
let defaultSearchParamsRef = React10.useRef(createSearchParams(defaultInit));
|
|
9290
9199
|
let hasSetSearchParamsRef = React10.useRef(false);
|
|
9291
|
-
let
|
|
9200
|
+
let location = useLocation();
|
|
9292
9201
|
let searchParams = React10.useMemo(
|
|
9293
9202
|
() => (
|
|
9294
9203
|
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
9295
9204
|
// Once we call that we want those to take precedence, otherwise you can't
|
|
9296
9205
|
// remove a param with setSearchParams({}) if it has an initial value
|
|
9297
9206
|
getSearchParamsForLocation(
|
|
9298
|
-
|
|
9207
|
+
location.search,
|
|
9299
9208
|
hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current
|
|
9300
9209
|
)
|
|
9301
9210
|
),
|
|
9302
|
-
[
|
|
9211
|
+
[location.search]
|
|
9303
9212
|
);
|
|
9304
9213
|
let navigate = useNavigate();
|
|
9305
9214
|
let setSearchParams = React10.useCallback(
|
|
@@ -9360,9 +9269,9 @@ function useFormAction(action, { relative } = {}) {
|
|
|
9360
9269
|
invariant(routeContext, "useFormAction must be used inside a RouteContext");
|
|
9361
9270
|
let [match] = routeContext.matches.slice(-1);
|
|
9362
9271
|
let path = { ...useResolvedPath(action ? action : ".", { relative }) };
|
|
9363
|
-
let
|
|
9272
|
+
let location = useLocation();
|
|
9364
9273
|
if (action == null) {
|
|
9365
|
-
path.search =
|
|
9274
|
+
path.search = location.search;
|
|
9366
9275
|
let params = new URLSearchParams(path.search);
|
|
9367
9276
|
let indexValues = params.getAll("index");
|
|
9368
9277
|
let hasNakedIndexParam = indexValues.some((v) => v === "");
|
|
@@ -9454,23 +9363,23 @@ function useFetchers() {
|
|
|
9454
9363
|
}
|
|
9455
9364
|
var SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions";
|
|
9456
9365
|
var savedScrollPositions = {};
|
|
9457
|
-
function getScrollRestorationKey(
|
|
9366
|
+
function getScrollRestorationKey(location, matches, basename, getKey) {
|
|
9458
9367
|
let key = null;
|
|
9459
9368
|
if (getKey) {
|
|
9460
9369
|
if (basename !== "/") {
|
|
9461
9370
|
key = getKey(
|
|
9462
9371
|
{
|
|
9463
|
-
...
|
|
9464
|
-
pathname: stripBasename(
|
|
9372
|
+
...location,
|
|
9373
|
+
pathname: stripBasename(location.pathname, basename) || location.pathname
|
|
9465
9374
|
},
|
|
9466
9375
|
matches
|
|
9467
9376
|
);
|
|
9468
9377
|
} else {
|
|
9469
|
-
key = getKey(
|
|
9378
|
+
key = getKey(location, matches);
|
|
9470
9379
|
}
|
|
9471
9380
|
}
|
|
9472
9381
|
if (key == null) {
|
|
9473
|
-
key =
|
|
9382
|
+
key = location.key;
|
|
9474
9383
|
}
|
|
9475
9384
|
return key;
|
|
9476
9385
|
}
|
|
@@ -9483,7 +9392,7 @@ function useScrollRestoration({
|
|
|
9483
9392
|
"useScrollRestoration" /* UseScrollRestoration */
|
|
9484
9393
|
);
|
|
9485
9394
|
let { basename } = React10.useContext(NavigationContext);
|
|
9486
|
-
let
|
|
9395
|
+
let location = useLocation();
|
|
9487
9396
|
let matches = useMatches();
|
|
9488
9397
|
let navigation = useNavigation();
|
|
9489
9398
|
React10.useEffect(() => {
|
|
@@ -9495,7 +9404,7 @@ function useScrollRestoration({
|
|
|
9495
9404
|
usePageHide(
|
|
9496
9405
|
React10.useCallback(() => {
|
|
9497
9406
|
if (navigation.state === "idle") {
|
|
9498
|
-
let key = getScrollRestorationKey(
|
|
9407
|
+
let key = getScrollRestorationKey(location, matches, basename, getKey);
|
|
9499
9408
|
savedScrollPositions[key] = window.scrollY;
|
|
9500
9409
|
}
|
|
9501
9410
|
try {
|
|
@@ -9510,7 +9419,7 @@ function useScrollRestoration({
|
|
|
9510
9419
|
);
|
|
9511
9420
|
}
|
|
9512
9421
|
window.history.scrollRestoration = "auto";
|
|
9513
|
-
}, [navigation.state, getKey, basename,
|
|
9422
|
+
}, [navigation.state, getKey, basename, location, matches, storageKey])
|
|
9514
9423
|
);
|
|
9515
9424
|
if (typeof document !== "undefined") {
|
|
9516
9425
|
React10.useLayoutEffect(() => {
|
|
@@ -9528,7 +9437,7 @@ function useScrollRestoration({
|
|
|
9528
9437
|
let disableScrollRestoration = router?.enableScrollRestoration(
|
|
9529
9438
|
savedScrollPositions,
|
|
9530
9439
|
() => window.scrollY,
|
|
9531
|
-
getKey ? (
|
|
9440
|
+
getKey ? (location2, matches2) => getScrollRestorationKey(location2, matches2, basename, getKey) : void 0
|
|
9532
9441
|
);
|
|
9533
9442
|
return () => disableScrollRestoration && disableScrollRestoration();
|
|
9534
9443
|
}, [router, basename, getKey]);
|
|
@@ -9540,9 +9449,9 @@ function useScrollRestoration({
|
|
|
9540
9449
|
window.scrollTo(0, restoreScrollPosition);
|
|
9541
9450
|
return;
|
|
9542
9451
|
}
|
|
9543
|
-
if (
|
|
9452
|
+
if (location.hash) {
|
|
9544
9453
|
let el = document.getElementById(
|
|
9545
|
-
decodeURIComponent(
|
|
9454
|
+
decodeURIComponent(location.hash.slice(1))
|
|
9546
9455
|
);
|
|
9547
9456
|
if (el) {
|
|
9548
9457
|
el.scrollIntoView();
|
|
@@ -9553,7 +9462,7 @@ function useScrollRestoration({
|
|
|
9553
9462
|
return;
|
|
9554
9463
|
}
|
|
9555
9464
|
window.scrollTo(0, 0);
|
|
9556
|
-
}, [
|
|
9465
|
+
}, [location, restoreScrollPosition, preventScrollReset]);
|
|
9557
9466
|
}
|
|
9558
9467
|
}
|
|
9559
9468
|
function useBeforeUnload(callback, options) {
|
|
@@ -9626,7 +9535,7 @@ function StaticRouter({
|
|
|
9626
9535
|
locationProp = parsePath(locationProp);
|
|
9627
9536
|
}
|
|
9628
9537
|
let action = "POP" /* Pop */;
|
|
9629
|
-
let
|
|
9538
|
+
let location = {
|
|
9630
9539
|
pathname: locationProp.pathname || "/",
|
|
9631
9540
|
search: locationProp.search || "",
|
|
9632
9541
|
hash: locationProp.hash || "",
|
|
@@ -9639,7 +9548,7 @@ function StaticRouter({
|
|
|
9639
9548
|
{
|
|
9640
9549
|
basename,
|
|
9641
9550
|
children,
|
|
9642
|
-
location
|
|
9551
|
+
location,
|
|
9643
9552
|
navigationType: action,
|
|
9644
9553
|
navigator: staticNavigator,
|
|
9645
9554
|
static: true
|
|
@@ -9858,9 +9767,6 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
9858
9767
|
_internalFetchControllers: /* @__PURE__ */ new Map(),
|
|
9859
9768
|
_internalSetRoutes() {
|
|
9860
9769
|
throw msg("_internalSetRoutes");
|
|
9861
|
-
},
|
|
9862
|
-
_internalSetStateDoNotUseOrYouWillBreakYourApp() {
|
|
9863
|
-
throw msg("_internalSetStateDoNotUseOrYouWillBreakYourApp");
|
|
9864
9770
|
}
|
|
9865
9771
|
};
|
|
9866
9772
|
}
|
|
@@ -10522,7 +10428,7 @@ function createServerHandoffString(serverHandoff) {
|
|
|
10522
10428
|
|
|
10523
10429
|
// lib/server-runtime/headers.ts
|
|
10524
10430
|
import { splitCookiesString } from "set-cookie-parser";
|
|
10525
|
-
function getDocumentHeaders(
|
|
10431
|
+
function getDocumentHeaders(build, context) {
|
|
10526
10432
|
return getDocumentHeadersImpl(context, (m) => {
|
|
10527
10433
|
let route = build.routes[m.route.id];
|
|
10528
10434
|
invariant3(route, `Route with id "${m.route.id}" not found in build`);
|
|
@@ -10599,7 +10505,7 @@ var SERVER_NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([
|
|
|
10599
10505
|
async function singleFetchAction(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError) {
|
|
10600
10506
|
try {
|
|
10601
10507
|
let respond2 = function(context) {
|
|
10602
|
-
let headers = getDocumentHeaders(
|
|
10508
|
+
let headers = getDocumentHeaders(build, context);
|
|
10603
10509
|
if (isRedirectStatusCode(context.statusCode) && headers.has("Location")) {
|
|
10604
10510
|
return generateSingleFetchResponse(request, build, serverMode, {
|
|
10605
10511
|
result: getSingleFetchRedirect(
|
|
@@ -10674,7 +10580,7 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand
|
|
|
10674
10580
|
async function singleFetchLoaders(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError) {
|
|
10675
10581
|
try {
|
|
10676
10582
|
let respond2 = function(context) {
|
|
10677
|
-
let headers = getDocumentHeaders(
|
|
10583
|
+
let headers = getDocumentHeaders(build, context);
|
|
10678
10584
|
if (isRedirectStatusCode(context.statusCode) && headers.has("Location")) {
|
|
10679
10585
|
return generateSingleFetchResponse(request, build, serverMode, {
|
|
10680
10586
|
result: {
|
|
@@ -11141,7 +11047,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
11141
11047
|
if (isResponse(context)) {
|
|
11142
11048
|
return context;
|
|
11143
11049
|
}
|
|
11144
|
-
let headers = getDocumentHeaders(
|
|
11050
|
+
let headers = getDocumentHeaders(build, context);
|
|
11145
11051
|
if (SERVER_NO_BODY_STATUS_CODES.has(context.statusCode)) {
|
|
11146
11052
|
return new Response(null, { status: context.statusCode, headers });
|
|
11147
11053
|
}
|
|
@@ -11482,819 +11388,6 @@ function href(path, ...args) {
|
|
|
11482
11388
|
}).filter((segment) => segment !== void 0).join("/");
|
|
11483
11389
|
}
|
|
11484
11390
|
|
|
11485
|
-
// lib/rsc/browser.tsx
|
|
11486
|
-
import * as React14 from "react";
|
|
11487
|
-
|
|
11488
|
-
// lib/dom/ssr/hydration.tsx
|
|
11489
|
-
function getHydrationData(state, routes, getRouteInfo, location2, basename, isSpaMode) {
|
|
11490
|
-
let hydrationData = {
|
|
11491
|
-
...state,
|
|
11492
|
-
loaderData: { ...state.loaderData }
|
|
11493
|
-
};
|
|
11494
|
-
let initialMatches = matchRoutes(routes, location2, basename);
|
|
11495
|
-
if (initialMatches) {
|
|
11496
|
-
for (let match of initialMatches) {
|
|
11497
|
-
let routeId = match.route.id;
|
|
11498
|
-
let routeInfo = getRouteInfo(routeId);
|
|
11499
|
-
if (shouldHydrateRouteLoader(
|
|
11500
|
-
routeId,
|
|
11501
|
-
routeInfo.clientLoader,
|
|
11502
|
-
routeInfo.hasLoader,
|
|
11503
|
-
isSpaMode
|
|
11504
|
-
) && (routeInfo.hasHydrateFallback || !routeInfo.hasLoader)) {
|
|
11505
|
-
delete hydrationData.loaderData[routeId];
|
|
11506
|
-
} else if (!routeInfo.hasLoader) {
|
|
11507
|
-
hydrationData.loaderData[routeId] = null;
|
|
11508
|
-
}
|
|
11509
|
-
}
|
|
11510
|
-
}
|
|
11511
|
-
return hydrationData;
|
|
11512
|
-
}
|
|
11513
|
-
|
|
11514
|
-
// lib/rsc/browser.tsx
|
|
11515
|
-
function createCallServer({
|
|
11516
|
-
decode: decode2,
|
|
11517
|
-
encodeAction
|
|
11518
|
-
}) {
|
|
11519
|
-
let landedActionId = 0;
|
|
11520
|
-
return async (id, args) => {
|
|
11521
|
-
let actionId = window.__routerActionID = (window.__routerActionID ?? (window.__routerActionID = 0)) + 1;
|
|
11522
|
-
const response = await fetch(location.href, {
|
|
11523
|
-
body: await encodeAction(args),
|
|
11524
|
-
method: "POST",
|
|
11525
|
-
headers: {
|
|
11526
|
-
Accept: "text/x-component",
|
|
11527
|
-
"rsc-action-id": id
|
|
11528
|
-
}
|
|
11529
|
-
});
|
|
11530
|
-
if (!response.body) {
|
|
11531
|
-
throw new Error("No response body");
|
|
11532
|
-
}
|
|
11533
|
-
const payload = await decode2(response.body);
|
|
11534
|
-
if (payload.type === "redirect") {
|
|
11535
|
-
if (payload.reload) {
|
|
11536
|
-
window.location.href = payload.location;
|
|
11537
|
-
return;
|
|
11538
|
-
}
|
|
11539
|
-
let reject;
|
|
11540
|
-
const promise = new Promise((resolve, rejectFn) => {
|
|
11541
|
-
reject = rejectFn;
|
|
11542
|
-
});
|
|
11543
|
-
const unsubscribe = window.__router.subscribe(({ navigation }) => {
|
|
11544
|
-
if (navigation.state === "idle") {
|
|
11545
|
-
unsubscribe();
|
|
11546
|
-
reject(Symbol.for("react-router.redirect"));
|
|
11547
|
-
}
|
|
11548
|
-
});
|
|
11549
|
-
window.__router.navigate(payload.location, {
|
|
11550
|
-
replace: payload.replace
|
|
11551
|
-
});
|
|
11552
|
-
return promise;
|
|
11553
|
-
}
|
|
11554
|
-
if (payload.type !== "action") {
|
|
11555
|
-
throw new Error("Unexpected payload type");
|
|
11556
|
-
}
|
|
11557
|
-
if (payload.rerender) {
|
|
11558
|
-
(async () => {
|
|
11559
|
-
const rerender = await payload.rerender;
|
|
11560
|
-
if (!rerender) return;
|
|
11561
|
-
if (landedActionId < actionId && window.__routerActionID <= actionId) {
|
|
11562
|
-
landedActionId = actionId;
|
|
11563
|
-
if (rerender.type === "redirect") {
|
|
11564
|
-
if (rerender.reload) {
|
|
11565
|
-
window.location.href = rerender.location;
|
|
11566
|
-
return;
|
|
11567
|
-
}
|
|
11568
|
-
window.__router.navigate(rerender.location, {
|
|
11569
|
-
replace: rerender.replace
|
|
11570
|
-
});
|
|
11571
|
-
return;
|
|
11572
|
-
}
|
|
11573
|
-
let lastMatch;
|
|
11574
|
-
for (const match of rerender.matches) {
|
|
11575
|
-
window.__router.patchRoutes(
|
|
11576
|
-
lastMatch?.id ?? null,
|
|
11577
|
-
[createRouteFromServerManifest(match)],
|
|
11578
|
-
true
|
|
11579
|
-
);
|
|
11580
|
-
lastMatch = match;
|
|
11581
|
-
}
|
|
11582
|
-
window.__router._internalSetStateDoNotUseOrYouWillBreakYourApp({});
|
|
11583
|
-
React14.startTransition(() => {
|
|
11584
|
-
window.__router._internalSetStateDoNotUseOrYouWillBreakYourApp({
|
|
11585
|
-
loaderData: Object.assign(
|
|
11586
|
-
{},
|
|
11587
|
-
window.__router.state.loaderData,
|
|
11588
|
-
rerender.loaderData
|
|
11589
|
-
),
|
|
11590
|
-
errors: rerender.errors ? Object.assign(
|
|
11591
|
-
{},
|
|
11592
|
-
window.__router.state.errors,
|
|
11593
|
-
rerender.errors
|
|
11594
|
-
) : null
|
|
11595
|
-
});
|
|
11596
|
-
});
|
|
11597
|
-
}
|
|
11598
|
-
})();
|
|
11599
|
-
}
|
|
11600
|
-
return payload.actionResult;
|
|
11601
|
-
};
|
|
11602
|
-
}
|
|
11603
|
-
function createRouterFromPayload({
|
|
11604
|
-
decode: decode2,
|
|
11605
|
-
payload
|
|
11606
|
-
}) {
|
|
11607
|
-
if (window.__router) return window.__router;
|
|
11608
|
-
if (payload.type !== "render") throw new Error("Invalid payload type");
|
|
11609
|
-
let patches = /* @__PURE__ */ new Map();
|
|
11610
|
-
payload.patches?.forEach((patch) => {
|
|
11611
|
-
invariant(patch.parentId, "Invalid patch parentId");
|
|
11612
|
-
if (!patches.has(patch.parentId)) {
|
|
11613
|
-
patches.set(patch.parentId, []);
|
|
11614
|
-
}
|
|
11615
|
-
patches.get(patch.parentId)?.push(patch);
|
|
11616
|
-
});
|
|
11617
|
-
let routes = payload.matches.reduceRight((previous, match) => {
|
|
11618
|
-
const route = createRouteFromServerManifest(
|
|
11619
|
-
match,
|
|
11620
|
-
payload
|
|
11621
|
-
);
|
|
11622
|
-
if (previous.length > 0) {
|
|
11623
|
-
route.children = previous;
|
|
11624
|
-
let childrenToPatch = patches.get(match.id);
|
|
11625
|
-
if (childrenToPatch) {
|
|
11626
|
-
route.children.push(
|
|
11627
|
-
...childrenToPatch.map((r) => createRouteFromServerManifest(r))
|
|
11628
|
-
);
|
|
11629
|
-
}
|
|
11630
|
-
}
|
|
11631
|
-
return [route];
|
|
11632
|
-
}, []);
|
|
11633
|
-
window.__router = createRouter({
|
|
11634
|
-
routes,
|
|
11635
|
-
basename: payload.basename,
|
|
11636
|
-
history: createBrowserHistory(),
|
|
11637
|
-
hydrationData: getHydrationData(
|
|
11638
|
-
{
|
|
11639
|
-
loaderData: payload.loaderData,
|
|
11640
|
-
actionData: payload.actionData,
|
|
11641
|
-
errors: payload.errors
|
|
11642
|
-
},
|
|
11643
|
-
routes,
|
|
11644
|
-
(routeId) => {
|
|
11645
|
-
let match = payload.matches.find((m) => m.id === routeId);
|
|
11646
|
-
invariant(match, "Route not found in payload");
|
|
11647
|
-
return {
|
|
11648
|
-
clientLoader: match.clientLoader,
|
|
11649
|
-
hasLoader: match.hasLoader,
|
|
11650
|
-
hasHydrateFallback: match.hydrateFallbackElement != null
|
|
11651
|
-
};
|
|
11652
|
-
},
|
|
11653
|
-
payload.location,
|
|
11654
|
-
void 0,
|
|
11655
|
-
false
|
|
11656
|
-
),
|
|
11657
|
-
async patchRoutesOnNavigation({ path, signal }) {
|
|
11658
|
-
if (discoveredPaths2.has(path)) {
|
|
11659
|
-
return;
|
|
11660
|
-
}
|
|
11661
|
-
await fetchAndApplyManifestPatches2([path], decode2, signal);
|
|
11662
|
-
},
|
|
11663
|
-
// FIXME: Pass `build.ssr` and `build.basename` into this function
|
|
11664
|
-
dataStrategy: getRSCSingleFetchDataStrategy(
|
|
11665
|
-
() => window.__router,
|
|
11666
|
-
true,
|
|
11667
|
-
void 0,
|
|
11668
|
-
decode2
|
|
11669
|
-
)
|
|
11670
|
-
});
|
|
11671
|
-
if (window.__router.state.initialized) {
|
|
11672
|
-
window.__routerInitialized = true;
|
|
11673
|
-
window.__router.initialize();
|
|
11674
|
-
} else {
|
|
11675
|
-
window.__routerInitialized = false;
|
|
11676
|
-
}
|
|
11677
|
-
let lastLoaderData = void 0;
|
|
11678
|
-
window.__router.subscribe(({ loaderData, actionData }) => {
|
|
11679
|
-
if (lastLoaderData !== loaderData) {
|
|
11680
|
-
window.__routerActionID = (window.__routerActionID ?? (window.__routerActionID = 0)) + 1;
|
|
11681
|
-
}
|
|
11682
|
-
});
|
|
11683
|
-
return window.__router;
|
|
11684
|
-
}
|
|
11685
|
-
var renderedRoutesContext = unstable_createContext();
|
|
11686
|
-
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, decode2) {
|
|
11687
|
-
let dataStrategy = getSingleFetchDataStrategyImpl(
|
|
11688
|
-
getRouter,
|
|
11689
|
-
(match) => {
|
|
11690
|
-
let M = match;
|
|
11691
|
-
return {
|
|
11692
|
-
hasLoader: M.route.hasLoader,
|
|
11693
|
-
hasClientLoader: M.route.hasClientLoader,
|
|
11694
|
-
hasAction: M.route.hasAction,
|
|
11695
|
-
hasClientAction: M.route.hasClientAction,
|
|
11696
|
-
hasShouldRevalidate: M.route.hasShouldRevalidate
|
|
11697
|
-
};
|
|
11698
|
-
},
|
|
11699
|
-
// pass map into fetchAndDecode so it can add payloads
|
|
11700
|
-
getFetchAndDecodeViaRSC(decode2),
|
|
11701
|
-
ssr,
|
|
11702
|
-
basename,
|
|
11703
|
-
// If we don't have an element, we need to hit the server loader flow
|
|
11704
|
-
// regardless of whether the client loader calls `serverLoader` or not,
|
|
11705
|
-
// otherwise we'll have nothing to render.
|
|
11706
|
-
// TODO: Do we need to account for API routes? Do we need a
|
|
11707
|
-
// `match.hasComponent` flag?
|
|
11708
|
-
(match) => match.route.element != null
|
|
11709
|
-
);
|
|
11710
|
-
return async (args) => args.unstable_runClientMiddleware(async () => {
|
|
11711
|
-
let context = args.context;
|
|
11712
|
-
context.set(renderedRoutesContext, []);
|
|
11713
|
-
let results = await dataStrategy(args);
|
|
11714
|
-
const renderedRoutesById = /* @__PURE__ */ new Map();
|
|
11715
|
-
for (const route of context.get(renderedRoutesContext)) {
|
|
11716
|
-
if (!renderedRoutesById.has(route.id)) {
|
|
11717
|
-
renderedRoutesById.set(route.id, []);
|
|
11718
|
-
}
|
|
11719
|
-
renderedRoutesById.get(route.id).push(route);
|
|
11720
|
-
}
|
|
11721
|
-
for (const match of args.matches) {
|
|
11722
|
-
const renderedRoutes = renderedRoutesById.get(match.route.id);
|
|
11723
|
-
if (renderedRoutes) {
|
|
11724
|
-
for (const rendered of renderedRoutes) {
|
|
11725
|
-
window.__router.patchRoutes(
|
|
11726
|
-
rendered.parentId ?? null,
|
|
11727
|
-
[createRouteFromServerManifest(rendered)],
|
|
11728
|
-
true
|
|
11729
|
-
);
|
|
11730
|
-
}
|
|
11731
|
-
}
|
|
11732
|
-
}
|
|
11733
|
-
return results;
|
|
11734
|
-
});
|
|
11735
|
-
}
|
|
11736
|
-
function getFetchAndDecodeViaRSC(decode2) {
|
|
11737
|
-
return async (args, basename, targetRoutes) => {
|
|
11738
|
-
let { request, context } = args;
|
|
11739
|
-
let url = singleFetchUrl(request.url, basename, "rsc");
|
|
11740
|
-
if (request.method === "GET") {
|
|
11741
|
-
url = stripIndexParam(url);
|
|
11742
|
-
if (targetRoutes) {
|
|
11743
|
-
url.searchParams.set("_routes", targetRoutes.join(","));
|
|
11744
|
-
}
|
|
11745
|
-
}
|
|
11746
|
-
let res = await fetch(url, await createRequestInit(request));
|
|
11747
|
-
if (res.status === 404 && !res.headers.has("X-Remix-Response")) {
|
|
11748
|
-
throw new ErrorResponseImpl(404, "Not Found", true);
|
|
11749
|
-
}
|
|
11750
|
-
invariant(res.body, "No response body to decode");
|
|
11751
|
-
try {
|
|
11752
|
-
const payload = await decode2(res.body);
|
|
11753
|
-
if (payload.type === "redirect") {
|
|
11754
|
-
return {
|
|
11755
|
-
status: res.status,
|
|
11756
|
-
data: {
|
|
11757
|
-
redirect: {
|
|
11758
|
-
redirect: payload.location,
|
|
11759
|
-
reload: false,
|
|
11760
|
-
replace: payload.replace,
|
|
11761
|
-
revalidate: false,
|
|
11762
|
-
status: payload.status
|
|
11763
|
-
}
|
|
11764
|
-
}
|
|
11765
|
-
};
|
|
11766
|
-
}
|
|
11767
|
-
if (payload.type !== "render") {
|
|
11768
|
-
throw new Error("Unexpected payload type");
|
|
11769
|
-
}
|
|
11770
|
-
context.get(renderedRoutesContext).push(...payload.matches);
|
|
11771
|
-
let results = { routes: {} };
|
|
11772
|
-
const dataKey = isMutationMethod(request.method) ? "actionData" : "loaderData";
|
|
11773
|
-
for (let [routeId, data2] of Object.entries(payload[dataKey] || {})) {
|
|
11774
|
-
results.routes[routeId] = { data: data2 };
|
|
11775
|
-
}
|
|
11776
|
-
if (payload.errors) {
|
|
11777
|
-
for (let [routeId, error] of Object.entries(payload.errors)) {
|
|
11778
|
-
results.routes[routeId] = { error };
|
|
11779
|
-
}
|
|
11780
|
-
}
|
|
11781
|
-
return { status: res.status, data: results };
|
|
11782
|
-
} catch (e) {
|
|
11783
|
-
throw new Error("Unable to decode RSC response");
|
|
11784
|
-
}
|
|
11785
|
-
};
|
|
11786
|
-
}
|
|
11787
|
-
function RSCHydratedRouter({
|
|
11788
|
-
decode: decode2,
|
|
11789
|
-
payload,
|
|
11790
|
-
routeDiscovery = "eager"
|
|
11791
|
-
}) {
|
|
11792
|
-
if (payload.type !== "render") throw new Error("Invalid payload type");
|
|
11793
|
-
let router = React14.useMemo(
|
|
11794
|
-
() => createRouterFromPayload({ decode: decode2, payload }),
|
|
11795
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11796
|
-
[]
|
|
11797
|
-
);
|
|
11798
|
-
React14.useLayoutEffect(() => {
|
|
11799
|
-
if (!window.__routerInitialized) {
|
|
11800
|
-
window.__routerInitialized = true;
|
|
11801
|
-
window.__router.initialize();
|
|
11802
|
-
}
|
|
11803
|
-
}, []);
|
|
11804
|
-
React14.useEffect(() => {
|
|
11805
|
-
if (routeDiscovery === "lazy" || // @ts-expect-error - TS doesn't know about this yet
|
|
11806
|
-
window.navigator?.connection?.saveData === true) {
|
|
11807
|
-
return;
|
|
11808
|
-
}
|
|
11809
|
-
function registerElement(el) {
|
|
11810
|
-
let path = el.tagName === "FORM" ? el.getAttribute("action") : el.getAttribute("href");
|
|
11811
|
-
if (!path) {
|
|
11812
|
-
return;
|
|
11813
|
-
}
|
|
11814
|
-
let pathname = el.tagName === "A" ? el.pathname : new URL(path, window.location.origin).pathname;
|
|
11815
|
-
if (!discoveredPaths2.has(pathname)) {
|
|
11816
|
-
nextPaths2.add(pathname);
|
|
11817
|
-
}
|
|
11818
|
-
}
|
|
11819
|
-
async function fetchPatches() {
|
|
11820
|
-
document.querySelectorAll("a[data-discover], form[data-discover]").forEach(registerElement);
|
|
11821
|
-
let paths = Array.from(nextPaths2.keys()).filter((path) => {
|
|
11822
|
-
if (discoveredPaths2.has(path)) {
|
|
11823
|
-
nextPaths2.delete(path);
|
|
11824
|
-
return false;
|
|
11825
|
-
}
|
|
11826
|
-
return true;
|
|
11827
|
-
});
|
|
11828
|
-
if (paths.length === 0) {
|
|
11829
|
-
return;
|
|
11830
|
-
}
|
|
11831
|
-
try {
|
|
11832
|
-
await fetchAndApplyManifestPatches2(paths, decode2);
|
|
11833
|
-
} catch (e) {
|
|
11834
|
-
console.error("Failed to fetch manifest patches", e);
|
|
11835
|
-
}
|
|
11836
|
-
}
|
|
11837
|
-
let debouncedFetchPatches = debounce2(fetchPatches, 100);
|
|
11838
|
-
fetchPatches();
|
|
11839
|
-
let observer = new MutationObserver(() => debouncedFetchPatches());
|
|
11840
|
-
observer.observe(document.documentElement, {
|
|
11841
|
-
subtree: true,
|
|
11842
|
-
childList: true,
|
|
11843
|
-
attributes: true,
|
|
11844
|
-
attributeFilter: ["data-discover", "href", "action"]
|
|
11845
|
-
});
|
|
11846
|
-
}, [routeDiscovery, decode2]);
|
|
11847
|
-
const frameworkContext = {
|
|
11848
|
-
future: {
|
|
11849
|
-
// These flags have no runtime impact so can always be false. If we add
|
|
11850
|
-
// flags that drive runtime behavior they'll need to be proxied through.
|
|
11851
|
-
unstable_middleware: false,
|
|
11852
|
-
unstable_subResourceIntegrity: false
|
|
11853
|
-
},
|
|
11854
|
-
isSpaMode: true,
|
|
11855
|
-
ssr: true,
|
|
11856
|
-
criticalCss: "",
|
|
11857
|
-
manifest: {
|
|
11858
|
-
routes: {},
|
|
11859
|
-
version: "1",
|
|
11860
|
-
url: "",
|
|
11861
|
-
entry: {
|
|
11862
|
-
module: "",
|
|
11863
|
-
imports: []
|
|
11864
|
-
}
|
|
11865
|
-
},
|
|
11866
|
-
routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" },
|
|
11867
|
-
routeModules: {}
|
|
11868
|
-
};
|
|
11869
|
-
return /* @__PURE__ */ React14.createElement(FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React14.createElement(RouterProvider, { router }));
|
|
11870
|
-
}
|
|
11871
|
-
function createRouteFromServerManifest(match, payload) {
|
|
11872
|
-
let hasInitialData = payload && match.id in payload.loaderData;
|
|
11873
|
-
let initialData = payload?.loaderData[match.id];
|
|
11874
|
-
let hasInitialError = payload?.errors && match.id in payload.errors;
|
|
11875
|
-
let initialError = payload?.errors?.[match.id];
|
|
11876
|
-
let isHydrationRequest = match.clientLoader?.hydrate === true || !match.hasLoader || // If we don't have an element, we need to hit the server loader flow
|
|
11877
|
-
// regardless of whether the client loader calls `serverLoader` or not,
|
|
11878
|
-
// otherwise we'll have nothing to render.
|
|
11879
|
-
// TODO: Do we need to account for API routes? Do we need a
|
|
11880
|
-
// `match.hasComponent` flag?
|
|
11881
|
-
!match.element;
|
|
11882
|
-
let dataRoute = {
|
|
11883
|
-
id: match.id,
|
|
11884
|
-
element: match.element,
|
|
11885
|
-
errorElement: match.errorElement,
|
|
11886
|
-
handle: match.handle,
|
|
11887
|
-
hasErrorBoundary: match.hasErrorBoundary,
|
|
11888
|
-
hydrateFallbackElement: match.hydrateFallbackElement,
|
|
11889
|
-
index: match.index,
|
|
11890
|
-
loader: match.clientLoader ? async (args, singleFetch) => {
|
|
11891
|
-
try {
|
|
11892
|
-
let result = await match.clientLoader({
|
|
11893
|
-
...args,
|
|
11894
|
-
serverLoader: () => {
|
|
11895
|
-
preventInvalidServerHandlerCall2(
|
|
11896
|
-
"loader",
|
|
11897
|
-
match.id,
|
|
11898
|
-
match.hasLoader
|
|
11899
|
-
);
|
|
11900
|
-
if (isHydrationRequest) {
|
|
11901
|
-
if (hasInitialData) {
|
|
11902
|
-
return initialData;
|
|
11903
|
-
}
|
|
11904
|
-
if (hasInitialError) {
|
|
11905
|
-
throw initialError;
|
|
11906
|
-
}
|
|
11907
|
-
}
|
|
11908
|
-
return callSingleFetch(singleFetch);
|
|
11909
|
-
}
|
|
11910
|
-
});
|
|
11911
|
-
return result;
|
|
11912
|
-
} finally {
|
|
11913
|
-
isHydrationRequest = false;
|
|
11914
|
-
}
|
|
11915
|
-
} : (
|
|
11916
|
-
// We always make the call in this RSC world since even if we don't
|
|
11917
|
-
// have a `loader` we may need to get the `element` implementation
|
|
11918
|
-
(_, singleFetch) => callSingleFetch(singleFetch)
|
|
11919
|
-
),
|
|
11920
|
-
action: match.clientAction ? (args, singleFetch) => match.clientAction({
|
|
11921
|
-
...args,
|
|
11922
|
-
serverAction: async () => {
|
|
11923
|
-
preventInvalidServerHandlerCall2(
|
|
11924
|
-
"loader",
|
|
11925
|
-
match.id,
|
|
11926
|
-
match.hasLoader
|
|
11927
|
-
);
|
|
11928
|
-
return await callSingleFetch(singleFetch);
|
|
11929
|
-
}
|
|
11930
|
-
}) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : void 0,
|
|
11931
|
-
path: match.path,
|
|
11932
|
-
shouldRevalidate: match.shouldRevalidate,
|
|
11933
|
-
// We always have a "loader" in this RSC world since even if we don't
|
|
11934
|
-
// have a `loader` we may need to get the `element` implementation
|
|
11935
|
-
hasLoader: true,
|
|
11936
|
-
hasClientLoader: match.clientLoader != null,
|
|
11937
|
-
hasAction: match.hasAction,
|
|
11938
|
-
hasClientAction: match.clientAction != null,
|
|
11939
|
-
hasShouldRevalidate: match.shouldRevalidate != null
|
|
11940
|
-
};
|
|
11941
|
-
if (typeof dataRoute.loader === "function") {
|
|
11942
|
-
dataRoute.loader.hydrate = shouldHydrateRouteLoader(
|
|
11943
|
-
match.id,
|
|
11944
|
-
match.clientLoader,
|
|
11945
|
-
match.hasLoader,
|
|
11946
|
-
false
|
|
11947
|
-
);
|
|
11948
|
-
}
|
|
11949
|
-
return dataRoute;
|
|
11950
|
-
}
|
|
11951
|
-
function callSingleFetch(singleFetch) {
|
|
11952
|
-
invariant(typeof singleFetch === "function", "Invalid singleFetch parameter");
|
|
11953
|
-
return singleFetch();
|
|
11954
|
-
}
|
|
11955
|
-
function preventInvalidServerHandlerCall2(type, routeId, hasHandler) {
|
|
11956
|
-
if (!hasHandler) {
|
|
11957
|
-
let fn = type === "action" ? "serverAction()" : "serverLoader()";
|
|
11958
|
-
let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
|
|
11959
|
-
console.error(msg);
|
|
11960
|
-
throw new ErrorResponseImpl(400, "Bad Request", new Error(msg), true);
|
|
11961
|
-
}
|
|
11962
|
-
}
|
|
11963
|
-
var nextPaths2 = /* @__PURE__ */ new Set();
|
|
11964
|
-
var discoveredPathsMaxSize2 = 1e3;
|
|
11965
|
-
var discoveredPaths2 = /* @__PURE__ */ new Set();
|
|
11966
|
-
var URL_LIMIT2 = 7680;
|
|
11967
|
-
async function fetchAndApplyManifestPatches2(paths, decode2, signal) {
|
|
11968
|
-
let basename = (window.__router.basename ?? "").replace(/^\/|\/$/g, "");
|
|
11969
|
-
let url = new URL(`${basename}/.manifest`, window.location.origin);
|
|
11970
|
-
paths.sort().forEach((path) => url.searchParams.append("p", path));
|
|
11971
|
-
if (url.toString().length > URL_LIMIT2) {
|
|
11972
|
-
nextPaths2.clear();
|
|
11973
|
-
return;
|
|
11974
|
-
}
|
|
11975
|
-
let response = await fetch(url, { signal });
|
|
11976
|
-
if (!response.body || response.status < 200 || response.status >= 300) {
|
|
11977
|
-
throw new Error("Unable to fetch new route matches from the server");
|
|
11978
|
-
}
|
|
11979
|
-
let payload = await decode2(response.body);
|
|
11980
|
-
if (payload.type !== "manifest") {
|
|
11981
|
-
throw new Error("Failed to patch routes");
|
|
11982
|
-
}
|
|
11983
|
-
paths.forEach((p) => addToFifoQueue2(p, discoveredPaths2));
|
|
11984
|
-
payload.patches.forEach((p) => {
|
|
11985
|
-
window.__router.patchRoutes(p.parentId ?? null, [
|
|
11986
|
-
createRouteFromServerManifest(p)
|
|
11987
|
-
]);
|
|
11988
|
-
});
|
|
11989
|
-
}
|
|
11990
|
-
function addToFifoQueue2(path, queue) {
|
|
11991
|
-
if (queue.size >= discoveredPathsMaxSize2) {
|
|
11992
|
-
let first = queue.values().next().value;
|
|
11993
|
-
queue.delete(first);
|
|
11994
|
-
}
|
|
11995
|
-
queue.add(path);
|
|
11996
|
-
}
|
|
11997
|
-
function debounce2(callback, wait) {
|
|
11998
|
-
let timeoutId;
|
|
11999
|
-
return (...args) => {
|
|
12000
|
-
window.clearTimeout(timeoutId);
|
|
12001
|
-
timeoutId = window.setTimeout(() => callback(...args), wait);
|
|
12002
|
-
};
|
|
12003
|
-
}
|
|
12004
|
-
|
|
12005
|
-
// lib/rsc/server.ssr.tsx
|
|
12006
|
-
import * as React15 from "react";
|
|
12007
|
-
|
|
12008
|
-
// lib/rsc/html-stream/server.ts
|
|
12009
|
-
var encoder2 = new TextEncoder();
|
|
12010
|
-
var trailer = "</body></html>";
|
|
12011
|
-
function injectRSCPayload(rscStream) {
|
|
12012
|
-
let decoder = new TextDecoder();
|
|
12013
|
-
let resolveFlightDataPromise;
|
|
12014
|
-
let flightDataPromise = new Promise(
|
|
12015
|
-
(resolve) => resolveFlightDataPromise = resolve
|
|
12016
|
-
);
|
|
12017
|
-
let startedRSC = false;
|
|
12018
|
-
let buffered = [];
|
|
12019
|
-
let timeout = null;
|
|
12020
|
-
function flushBufferedChunks(controller) {
|
|
12021
|
-
for (let chunk of buffered) {
|
|
12022
|
-
let buf = decoder.decode(chunk, { stream: true });
|
|
12023
|
-
if (buf.endsWith(trailer)) {
|
|
12024
|
-
buf = buf.slice(0, -trailer.length);
|
|
12025
|
-
}
|
|
12026
|
-
controller.enqueue(encoder2.encode(buf));
|
|
12027
|
-
}
|
|
12028
|
-
buffered.length = 0;
|
|
12029
|
-
timeout = null;
|
|
12030
|
-
}
|
|
12031
|
-
return new TransformStream({
|
|
12032
|
-
transform(chunk, controller) {
|
|
12033
|
-
buffered.push(chunk);
|
|
12034
|
-
if (timeout) {
|
|
12035
|
-
return;
|
|
12036
|
-
}
|
|
12037
|
-
timeout = setTimeout(async () => {
|
|
12038
|
-
flushBufferedChunks(controller);
|
|
12039
|
-
if (!startedRSC) {
|
|
12040
|
-
startedRSC = true;
|
|
12041
|
-
writeRSCStream(rscStream, controller).catch((err) => controller.error(err)).then(resolveFlightDataPromise);
|
|
12042
|
-
}
|
|
12043
|
-
}, 0);
|
|
12044
|
-
},
|
|
12045
|
-
async flush(controller) {
|
|
12046
|
-
await flightDataPromise;
|
|
12047
|
-
if (timeout) {
|
|
12048
|
-
clearTimeout(timeout);
|
|
12049
|
-
flushBufferedChunks(controller);
|
|
12050
|
-
}
|
|
12051
|
-
controller.enqueue(encoder2.encode("</body></html>"));
|
|
12052
|
-
}
|
|
12053
|
-
});
|
|
12054
|
-
}
|
|
12055
|
-
async function writeRSCStream(rscStream, controller) {
|
|
12056
|
-
let decoder = new TextDecoder("utf-8", { fatal: true });
|
|
12057
|
-
const reader = rscStream.getReader();
|
|
12058
|
-
try {
|
|
12059
|
-
let read;
|
|
12060
|
-
while ((read = await reader.read()) && !read.done) {
|
|
12061
|
-
const chunk = read.value;
|
|
12062
|
-
try {
|
|
12063
|
-
writeChunk(
|
|
12064
|
-
JSON.stringify(decoder.decode(chunk, { stream: true })),
|
|
12065
|
-
controller
|
|
12066
|
-
);
|
|
12067
|
-
} catch (err) {
|
|
12068
|
-
let base64 = JSON.stringify(btoa(String.fromCodePoint(...chunk)));
|
|
12069
|
-
writeChunk(
|
|
12070
|
-
`Uint8Array.from(atob(${base64}), m => m.codePointAt(0))`,
|
|
12071
|
-
controller
|
|
12072
|
-
);
|
|
12073
|
-
}
|
|
12074
|
-
}
|
|
12075
|
-
} finally {
|
|
12076
|
-
reader.releaseLock();
|
|
12077
|
-
}
|
|
12078
|
-
let remaining = decoder.decode();
|
|
12079
|
-
if (remaining.length) {
|
|
12080
|
-
writeChunk(JSON.stringify(remaining), controller);
|
|
12081
|
-
}
|
|
12082
|
-
}
|
|
12083
|
-
function writeChunk(chunk, controller) {
|
|
12084
|
-
controller.enqueue(
|
|
12085
|
-
encoder2.encode(
|
|
12086
|
-
`<script>${escapeScript(
|
|
12087
|
-
`(self.__FLIGHT_DATA||=[]).push(${chunk})`
|
|
12088
|
-
)}</script>`
|
|
12089
|
-
)
|
|
12090
|
-
);
|
|
12091
|
-
}
|
|
12092
|
-
function escapeScript(script) {
|
|
12093
|
-
return script.replace(/<!--/g, "<\\!--").replace(/<\/(script)/gi, "</\\$1");
|
|
12094
|
-
}
|
|
12095
|
-
|
|
12096
|
-
// lib/rsc/server.ssr.tsx
|
|
12097
|
-
async function routeRSCServerRequest({
|
|
12098
|
-
request,
|
|
12099
|
-
callServer,
|
|
12100
|
-
decode: decode2,
|
|
12101
|
-
renderHTML,
|
|
12102
|
-
hydrate: hydrate2 = true
|
|
12103
|
-
}) {
|
|
12104
|
-
const url = new URL(request.url);
|
|
12105
|
-
let serverRequest = request;
|
|
12106
|
-
const isDataRequest = isReactServerRequest(url);
|
|
12107
|
-
const respondWithRSCPayload = isDataRequest || isManifestRequest(url) || request.headers.has("rsc-action-id");
|
|
12108
|
-
if (isDataRequest) {
|
|
12109
|
-
const serverURL = new URL(request.url);
|
|
12110
|
-
serverURL.pathname = serverURL.pathname.replace(/(_root)?\.rsc$/, "");
|
|
12111
|
-
let headers = new Headers(request.headers);
|
|
12112
|
-
headers.set("X-React-Router-Data-Request", "true");
|
|
12113
|
-
serverRequest = new Request(serverURL, {
|
|
12114
|
-
body: request.body,
|
|
12115
|
-
duplex: request.body ? "half" : void 0,
|
|
12116
|
-
headers,
|
|
12117
|
-
method: request.method,
|
|
12118
|
-
signal: request.signal
|
|
12119
|
-
});
|
|
12120
|
-
}
|
|
12121
|
-
const serverResponse = await callServer(serverRequest);
|
|
12122
|
-
if (respondWithRSCPayload) {
|
|
12123
|
-
return serverResponse;
|
|
12124
|
-
}
|
|
12125
|
-
if (!serverResponse.body) {
|
|
12126
|
-
throw new Error("Missing body in server response");
|
|
12127
|
-
}
|
|
12128
|
-
let serverResponseB = null;
|
|
12129
|
-
if (hydrate2) {
|
|
12130
|
-
serverResponseB = serverResponse.clone();
|
|
12131
|
-
}
|
|
12132
|
-
const body = serverResponse.body;
|
|
12133
|
-
let payloadPromise;
|
|
12134
|
-
const getPayload = async () => {
|
|
12135
|
-
if (payloadPromise) return payloadPromise;
|
|
12136
|
-
payloadPromise = decode2(body);
|
|
12137
|
-
return payloadPromise;
|
|
12138
|
-
};
|
|
12139
|
-
try {
|
|
12140
|
-
const html = await renderHTML(getPayload);
|
|
12141
|
-
const headers = new Headers(serverResponse.headers);
|
|
12142
|
-
headers.set("Content-Type", "text/html");
|
|
12143
|
-
if (!hydrate2) {
|
|
12144
|
-
return new Response(html, {
|
|
12145
|
-
status: serverResponse.status,
|
|
12146
|
-
headers
|
|
12147
|
-
});
|
|
12148
|
-
}
|
|
12149
|
-
if (!serverResponseB?.body) {
|
|
12150
|
-
throw new Error("Failed to clone server response");
|
|
12151
|
-
}
|
|
12152
|
-
const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body));
|
|
12153
|
-
return new Response(body2, {
|
|
12154
|
-
status: serverResponse.status,
|
|
12155
|
-
headers
|
|
12156
|
-
});
|
|
12157
|
-
} catch (reason) {
|
|
12158
|
-
if (reason instanceof Response) {
|
|
12159
|
-
return reason;
|
|
12160
|
-
}
|
|
12161
|
-
throw reason;
|
|
12162
|
-
}
|
|
12163
|
-
}
|
|
12164
|
-
function RSCStaticRouter({
|
|
12165
|
-
getPayload
|
|
12166
|
-
}) {
|
|
12167
|
-
const payload = React15.use(getPayload());
|
|
12168
|
-
if (payload.type === "redirect") {
|
|
12169
|
-
throw new Response(null, {
|
|
12170
|
-
status: payload.status,
|
|
12171
|
-
headers: {
|
|
12172
|
-
Location: payload.location
|
|
12173
|
-
}
|
|
12174
|
-
});
|
|
12175
|
-
}
|
|
12176
|
-
if (payload.type !== "render") return null;
|
|
12177
|
-
const context = {
|
|
12178
|
-
actionData: payload.actionData,
|
|
12179
|
-
actionHeaders: {},
|
|
12180
|
-
basename: payload.basename,
|
|
12181
|
-
errors: payload.errors,
|
|
12182
|
-
loaderData: payload.loaderData,
|
|
12183
|
-
loaderHeaders: {},
|
|
12184
|
-
location: payload.location,
|
|
12185
|
-
statusCode: 200,
|
|
12186
|
-
matches: payload.matches.map((match) => ({
|
|
12187
|
-
params: match.params,
|
|
12188
|
-
pathname: match.pathname,
|
|
12189
|
-
pathnameBase: match.pathnameBase,
|
|
12190
|
-
route: {
|
|
12191
|
-
id: match.id,
|
|
12192
|
-
action: match.hasAction || !!match.clientAction,
|
|
12193
|
-
handle: match.handle,
|
|
12194
|
-
hasErrorBoundary: match.hasErrorBoundary,
|
|
12195
|
-
loader: match.hasLoader || !!match.clientLoader,
|
|
12196
|
-
index: match.index,
|
|
12197
|
-
path: match.path,
|
|
12198
|
-
shouldRevalidate: match.shouldRevalidate
|
|
12199
|
-
}
|
|
12200
|
-
}))
|
|
12201
|
-
};
|
|
12202
|
-
const router = createStaticRouter(
|
|
12203
|
-
payload.matches.reduceRight((previous, match) => {
|
|
12204
|
-
const route = {
|
|
12205
|
-
id: match.id,
|
|
12206
|
-
action: match.hasAction || !!match.clientAction,
|
|
12207
|
-
element: match.element,
|
|
12208
|
-
errorElement: match.errorElement,
|
|
12209
|
-
handle: match.handle,
|
|
12210
|
-
hasErrorBoundary: !!match.errorElement,
|
|
12211
|
-
hydrateFallbackElement: match.hydrateFallbackElement,
|
|
12212
|
-
index: match.index,
|
|
12213
|
-
loader: match.hasLoader || !!match.clientLoader,
|
|
12214
|
-
path: match.path,
|
|
12215
|
-
shouldRevalidate: match.shouldRevalidate
|
|
12216
|
-
};
|
|
12217
|
-
if (previous.length > 0) {
|
|
12218
|
-
route.children = previous;
|
|
12219
|
-
}
|
|
12220
|
-
return [route];
|
|
12221
|
-
}, []),
|
|
12222
|
-
context
|
|
12223
|
-
);
|
|
12224
|
-
const frameworkContext = {
|
|
12225
|
-
future: {
|
|
12226
|
-
// These flags have no runtime impact so can always be false. If we add
|
|
12227
|
-
// flags that drive runtime behavior they'll need to be proxied through.
|
|
12228
|
-
unstable_middleware: false,
|
|
12229
|
-
unstable_subResourceIntegrity: false
|
|
12230
|
-
},
|
|
12231
|
-
isSpaMode: false,
|
|
12232
|
-
ssr: true,
|
|
12233
|
-
criticalCss: "",
|
|
12234
|
-
manifest: {
|
|
12235
|
-
routes: {},
|
|
12236
|
-
version: "1",
|
|
12237
|
-
url: "",
|
|
12238
|
-
entry: {
|
|
12239
|
-
module: "",
|
|
12240
|
-
imports: []
|
|
12241
|
-
}
|
|
12242
|
-
},
|
|
12243
|
-
routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" },
|
|
12244
|
-
routeModules: {}
|
|
12245
|
-
};
|
|
12246
|
-
return /* @__PURE__ */ React15.createElement(FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React15.createElement(
|
|
12247
|
-
StaticRouterProvider,
|
|
12248
|
-
{
|
|
12249
|
-
context,
|
|
12250
|
-
router,
|
|
12251
|
-
hydrate: false,
|
|
12252
|
-
nonce: payload.nonce
|
|
12253
|
-
}
|
|
12254
|
-
));
|
|
12255
|
-
}
|
|
12256
|
-
function isReactServerRequest(url) {
|
|
12257
|
-
return url.pathname.endsWith(".rsc");
|
|
12258
|
-
}
|
|
12259
|
-
function isManifestRequest(url) {
|
|
12260
|
-
return url.pathname.endsWith(".manifest");
|
|
12261
|
-
}
|
|
12262
|
-
|
|
12263
|
-
// lib/rsc/html-stream/browser.ts
|
|
12264
|
-
function getServerStream() {
|
|
12265
|
-
let encoder3 = new TextEncoder();
|
|
12266
|
-
let streamController = null;
|
|
12267
|
-
let rscStream = new ReadableStream({
|
|
12268
|
-
start(controller) {
|
|
12269
|
-
if (typeof window === "undefined") {
|
|
12270
|
-
return;
|
|
12271
|
-
}
|
|
12272
|
-
let handleChunk = (chunk) => {
|
|
12273
|
-
if (typeof chunk === "string") {
|
|
12274
|
-
controller.enqueue(encoder3.encode(chunk));
|
|
12275
|
-
} else {
|
|
12276
|
-
controller.enqueue(chunk);
|
|
12277
|
-
}
|
|
12278
|
-
};
|
|
12279
|
-
window.__FLIGHT_DATA || (window.__FLIGHT_DATA = []);
|
|
12280
|
-
window.__FLIGHT_DATA.forEach(handleChunk);
|
|
12281
|
-
window.__FLIGHT_DATA.push = (chunk) => {
|
|
12282
|
-
handleChunk(chunk);
|
|
12283
|
-
return 0;
|
|
12284
|
-
};
|
|
12285
|
-
streamController = controller;
|
|
12286
|
-
}
|
|
12287
|
-
});
|
|
12288
|
-
if (typeof document !== "undefined" && document.readyState === "loading") {
|
|
12289
|
-
document.addEventListener("DOMContentLoaded", () => {
|
|
12290
|
-
streamController?.close();
|
|
12291
|
-
});
|
|
12292
|
-
} else {
|
|
12293
|
-
streamController?.close();
|
|
12294
|
-
}
|
|
12295
|
-
return rscStream;
|
|
12296
|
-
}
|
|
12297
|
-
|
|
12298
11391
|
// lib/dom/ssr/errors.ts
|
|
12299
11392
|
function deserializeErrors2(errors) {
|
|
12300
11393
|
if (!errors) return null;
|
|
@@ -12332,6 +11425,32 @@ function deserializeErrors2(errors) {
|
|
|
12332
11425
|
return serialized;
|
|
12333
11426
|
}
|
|
12334
11427
|
|
|
11428
|
+
// lib/dom/ssr/hydration.tsx
|
|
11429
|
+
function getHydrationData(state, routes, getRouteInfo, location, basename, isSpaMode) {
|
|
11430
|
+
let hydrationData = {
|
|
11431
|
+
...state,
|
|
11432
|
+
loaderData: { ...state.loaderData }
|
|
11433
|
+
};
|
|
11434
|
+
let initialMatches = matchRoutes(routes, location, basename);
|
|
11435
|
+
if (initialMatches) {
|
|
11436
|
+
for (let match of initialMatches) {
|
|
11437
|
+
let routeId = match.route.id;
|
|
11438
|
+
let routeInfo = getRouteInfo(routeId);
|
|
11439
|
+
if (shouldHydrateRouteLoader(
|
|
11440
|
+
routeId,
|
|
11441
|
+
routeInfo.clientLoader,
|
|
11442
|
+
routeInfo.hasLoader,
|
|
11443
|
+
isSpaMode
|
|
11444
|
+
) && (routeInfo.hasHydrateFallback || !routeInfo.hasLoader)) {
|
|
11445
|
+
delete hydrationData.loaderData[routeId];
|
|
11446
|
+
} else if (!routeInfo.hasLoader) {
|
|
11447
|
+
hydrationData.loaderData[routeId] = null;
|
|
11448
|
+
}
|
|
11449
|
+
}
|
|
11450
|
+
}
|
|
11451
|
+
return hydrationData;
|
|
11452
|
+
}
|
|
11453
|
+
|
|
12335
11454
|
export {
|
|
12336
11455
|
Action,
|
|
12337
11456
|
createBrowserHistory,
|
|
@@ -12450,11 +11569,6 @@ export {
|
|
|
12450
11569
|
createCookieSessionStorage,
|
|
12451
11570
|
createMemorySessionStorage,
|
|
12452
11571
|
href,
|
|
12453
|
-
|
|
12454
|
-
|
|
12455
|
-
RSCHydratedRouter,
|
|
12456
|
-
routeRSCServerRequest,
|
|
12457
|
-
RSCStaticRouter,
|
|
12458
|
-
getServerStream,
|
|
12459
|
-
deserializeErrors2 as deserializeErrors
|
|
11572
|
+
deserializeErrors2 as deserializeErrors,
|
|
11573
|
+
getHydrationData
|
|
12460
11574
|
};
|