react-router 7.10.1 → 7.11.0-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -11
- package/dist/development/{browser-BpxEZgZC.d.ts → browser-Cv4JZyZ5.d.mts} +4 -3
- package/dist/{production/browser-BpxEZgZC.d.ts → development/browser-o-qhcuhA.d.ts} +4 -3
- package/dist/{production/chunk-B3F6YMOF.js → development/chunk-JKMHOZYW.js} +111 -121
- package/dist/development/{chunk-WWGJGFF6.mjs → chunk-KRMLYMWA.mjs} +231 -74
- package/dist/{production/chunk-YO5R3LGQ.js → development/chunk-OVG6YSZ5.js} +7 -7
- package/dist/development/{chunk-PMGK554W.mjs → chunk-QMKP6CC3.mjs} +147 -38
- package/dist/development/{chunk-RBZI3ZHD.js → chunk-UO7KGW2U.js} +279 -110
- package/dist/development/dom-export.d.mts +11 -10
- package/dist/development/dom-export.d.ts +12 -11
- package/dist/development/dom-export.js +30 -31
- package/dist/development/dom-export.mjs +6 -7
- package/dist/{production/index-react-server-client-CCjKYJTH.d.ts → development/index-react-server-client-Cv5Q9lf0.d.ts} +60 -14
- package/dist/development/{index-react-server-client-CipGfVBI.d.mts → index-react-server-client-P7VgYu6T.d.mts} +60 -14
- package/dist/development/index-react-server-client.d.mts +2 -2
- package/dist/development/index-react-server-client.d.ts +2 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +4 -2
- package/dist/development/index-react-server.d.ts +4 -2
- package/dist/development/index-react-server.js +72 -19
- package/dist/development/index-react-server.mjs +72 -19
- package/dist/development/index.d.mts +17 -16
- package/dist/development/index.d.ts +17 -16
- package/dist/development/index.js +220 -111
- package/dist/development/index.mjs +3 -3
- package/dist/{production/instrumentation-BB0wRuqz.d.ts → development/instrumentation-BlrVzjbg.d.ts} +30 -15
- package/dist/development/lib/types/internal.d.mts +2 -2
- package/dist/development/lib/types/internal.d.ts +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-ODDAAYlf.d.ts → register-BGQUMCK4.d.ts} +1 -1
- package/dist/development/{register-C1RwVJAt.d.mts → register-DTJJbt1o.d.mts} +1 -1
- package/dist/development/{router-CwNp5l9u.d.mts → router-5fbeEIMQ.d.mts} +30 -15
- package/dist/{development/browser-C5z6FZmz.d.mts → production/browser-Cv4JZyZ5.d.mts} +4 -3
- package/dist/production/{browser-C5z6FZmz.d.mts → browser-o-qhcuhA.d.ts} +4 -3
- package/dist/production/{chunk-UQPBOMFP.js → chunk-AO22ZXHI.js} +279 -110
- package/dist/production/{chunk-ANIOYBQK.mjs → chunk-IDHO4Q57.mjs} +231 -74
- package/dist/production/{chunk-TDCOAFPJ.mjs → chunk-J4JITZ76.mjs} +147 -38
- package/dist/{development/chunk-HMTWJNYB.js → production/chunk-M5W3Q3T5.js} +111 -121
- package/dist/{development/chunk-FKYGG5Z2.js → production/chunk-YGB3JEIP.js} +7 -7
- package/dist/production/dom-export.d.mts +11 -10
- package/dist/production/dom-export.d.ts +12 -11
- package/dist/production/dom-export.js +30 -31
- package/dist/production/dom-export.mjs +6 -7
- package/dist/{development/index-react-server-client-CCjKYJTH.d.ts → production/index-react-server-client-Cv5Q9lf0.d.ts} +60 -14
- package/dist/production/{index-react-server-client-CipGfVBI.d.mts → index-react-server-client-P7VgYu6T.d.mts} +60 -14
- package/dist/production/index-react-server-client.d.mts +2 -2
- package/dist/production/index-react-server-client.d.ts +2 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +4 -2
- package/dist/production/index-react-server.d.ts +4 -2
- package/dist/production/index-react-server.js +72 -19
- package/dist/production/index-react-server.mjs +72 -19
- package/dist/production/index.d.mts +17 -16
- package/dist/production/index.d.ts +17 -16
- package/dist/production/index.js +220 -111
- package/dist/production/index.mjs +3 -3
- package/dist/{development/instrumentation-BB0wRuqz.d.ts → production/instrumentation-BlrVzjbg.d.ts} +30 -15
- package/dist/production/lib/types/internal.d.mts +2 -2
- package/dist/production/lib/types/internal.d.ts +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{register-ODDAAYlf.d.ts → register-BGQUMCK4.d.ts} +1 -1
- package/dist/production/{register-C1RwVJAt.d.mts → register-DTJJbt1o.d.mts} +1 -1
- package/dist/production/{router-CwNp5l9u.d.mts → router-5fbeEIMQ.d.mts} +30 -15
- package/package.json +5 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.11.0-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -976,6 +976,41 @@ function isRouteErrorResponse(error) {
|
|
|
976
976
|
function getRoutePattern(matches) {
|
|
977
977
|
return matches.map((m) => m.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
|
|
978
978
|
}
|
|
979
|
+
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
980
|
+
function parseToInfo(_to, basename) {
|
|
981
|
+
let to = _to;
|
|
982
|
+
if (typeof to !== "string" || !ABSOLUTE_URL_REGEX.test(to)) {
|
|
983
|
+
return {
|
|
984
|
+
absoluteURL: void 0,
|
|
985
|
+
isExternal: false,
|
|
986
|
+
to
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
let absoluteURL = to;
|
|
990
|
+
let isExternal = false;
|
|
991
|
+
if (isBrowser) {
|
|
992
|
+
try {
|
|
993
|
+
let currentUrl = new URL(window.location.href);
|
|
994
|
+
let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
|
|
995
|
+
let path = stripBasename(targetUrl.pathname, basename);
|
|
996
|
+
if (targetUrl.origin === currentUrl.origin && path != null) {
|
|
997
|
+
to = path + targetUrl.search + targetUrl.hash;
|
|
998
|
+
} else {
|
|
999
|
+
isExternal = true;
|
|
1000
|
+
}
|
|
1001
|
+
} catch (e) {
|
|
1002
|
+
warning(
|
|
1003
|
+
false,
|
|
1004
|
+
`<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
|
|
1005
|
+
);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
return {
|
|
1009
|
+
absoluteURL,
|
|
1010
|
+
isExternal,
|
|
1011
|
+
to
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
979
1014
|
|
|
980
1015
|
// lib/router/instrumentation.ts
|
|
981
1016
|
var UninstrumentedSymbol = Symbol("Uninstrumented");
|
|
@@ -1295,7 +1330,7 @@ var TRANSITIONS_STORAGE_KEY = "remix-router-transitions";
|
|
|
1295
1330
|
var ResetLoaderDataSymbol = Symbol("ResetLoaderData");
|
|
1296
1331
|
function createRouter(init) {
|
|
1297
1332
|
const routerWindow = init.window ? init.window : typeof window !== "undefined" ? window : void 0;
|
|
1298
|
-
const
|
|
1333
|
+
const isBrowser2 = typeof routerWindow !== "undefined" && typeof routerWindow.document !== "undefined" && typeof routerWindow.document.createElement !== "undefined";
|
|
1299
1334
|
invariant(
|
|
1300
1335
|
init.routes.length > 0,
|
|
1301
1336
|
"You must provide a non-empty routes array to createRouter"
|
|
@@ -1478,7 +1513,7 @@ function createRouter(init) {
|
|
|
1478
1513
|
return startNavigation(historyAction, location);
|
|
1479
1514
|
}
|
|
1480
1515
|
);
|
|
1481
|
-
if (
|
|
1516
|
+
if (isBrowser2) {
|
|
1482
1517
|
restoreAppliedTransitions(routerWindow, appliedViewTransitions);
|
|
1483
1518
|
let _saveAppliedTransitions = () => persistAppliedTransitions(routerWindow, appliedViewTransitions);
|
|
1484
1519
|
routerWindow.addEventListener("pagehide", _saveAppliedTransitions);
|
|
@@ -1721,7 +1756,8 @@ function createRouter(init) {
|
|
|
1721
1756
|
preventScrollReset,
|
|
1722
1757
|
replace: opts && opts.replace,
|
|
1723
1758
|
enableViewTransition: opts && opts.viewTransition,
|
|
1724
|
-
flushSync
|
|
1759
|
+
flushSync,
|
|
1760
|
+
callSiteDefaultShouldRevalidate: opts && opts.unstable_defaultShouldRevalidate
|
|
1725
1761
|
});
|
|
1726
1762
|
}
|
|
1727
1763
|
function revalidate() {
|
|
@@ -1861,7 +1897,8 @@ function createRouter(init) {
|
|
|
1861
1897
|
opts && opts.replace,
|
|
1862
1898
|
opts && opts.initialHydration === true,
|
|
1863
1899
|
flushSync,
|
|
1864
|
-
pendingActionResult
|
|
1900
|
+
pendingActionResult,
|
|
1901
|
+
opts && opts.callSiteDefaultShouldRevalidate
|
|
1865
1902
|
);
|
|
1866
1903
|
if (shortCircuited) {
|
|
1867
1904
|
return;
|
|
@@ -2006,7 +2043,7 @@ function createRouter(init) {
|
|
|
2006
2043
|
pendingActionResult: [actionMatch.route.id, result]
|
|
2007
2044
|
};
|
|
2008
2045
|
}
|
|
2009
|
-
async function handleLoaders(request, location, matches, scopedContext, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace2, initialHydration, flushSync, pendingActionResult) {
|
|
2046
|
+
async function handleLoaders(request, location, matches, scopedContext, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace2, initialHydration, flushSync, pendingActionResult, callSiteDefaultShouldRevalidate) {
|
|
2010
2047
|
let loadingNavigation = overrideNavigation || getLoadingNavigation(location, submission);
|
|
2011
2048
|
let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);
|
|
2012
2049
|
let shouldUpdateNavigationState = !isUninterruptedRevalidation && !initialHydration;
|
|
@@ -2085,7 +2122,8 @@ function createRouter(init) {
|
|
|
2085
2122
|
routesToUse,
|
|
2086
2123
|
basename,
|
|
2087
2124
|
init.patchRoutesOnNavigation != null,
|
|
2088
|
-
pendingActionResult
|
|
2125
|
+
pendingActionResult,
|
|
2126
|
+
callSiteDefaultShouldRevalidate
|
|
2089
2127
|
);
|
|
2090
2128
|
pendingNavigationLoadId = ++incrementingLoadId;
|
|
2091
2129
|
if (!init.dataStrategy && !dsMatches.some((m) => m.shouldLoad) && !dsMatches.some(
|
|
@@ -2256,7 +2294,8 @@ function createRouter(init) {
|
|
|
2256
2294
|
fogOfWar.active,
|
|
2257
2295
|
flushSync,
|
|
2258
2296
|
preventScrollReset,
|
|
2259
|
-
submission
|
|
2297
|
+
submission,
|
|
2298
|
+
opts && opts.unstable_defaultShouldRevalidate
|
|
2260
2299
|
);
|
|
2261
2300
|
return;
|
|
2262
2301
|
}
|
|
@@ -2273,7 +2312,7 @@ function createRouter(init) {
|
|
|
2273
2312
|
submission
|
|
2274
2313
|
);
|
|
2275
2314
|
}
|
|
2276
|
-
async function handleFetcherAction(key, routeId, path, requestMatches, scopedContext, isFogOfWar, flushSync, preventScrollReset, submission) {
|
|
2315
|
+
async function handleFetcherAction(key, routeId, path, requestMatches, scopedContext, isFogOfWar, flushSync, preventScrollReset, submission, callSiteDefaultShouldRevalidate) {
|
|
2277
2316
|
interruptActiveLoads();
|
|
2278
2317
|
fetchLoadMatches.delete(key);
|
|
2279
2318
|
let existingFetcher = state.fetchers.get(key);
|
|
@@ -2411,7 +2450,8 @@ function createRouter(init) {
|
|
|
2411
2450
|
routesToUse,
|
|
2412
2451
|
basename,
|
|
2413
2452
|
init.patchRoutesOnNavigation != null,
|
|
2414
|
-
[match.route.id, actionResult]
|
|
2453
|
+
[match.route.id, actionResult],
|
|
2454
|
+
callSiteDefaultShouldRevalidate
|
|
2415
2455
|
);
|
|
2416
2456
|
revalidatingFetchers.filter((rf) => rf.key !== key).forEach((rf) => {
|
|
2417
2457
|
let staleKey = rf.key;
|
|
@@ -2613,7 +2653,7 @@ function createRouter(init) {
|
|
|
2613
2653
|
let redirectLocation = createLocation(state.location, location, {
|
|
2614
2654
|
_isRedirect: true
|
|
2615
2655
|
});
|
|
2616
|
-
if (
|
|
2656
|
+
if (isBrowser2) {
|
|
2617
2657
|
let isDocumentReload = false;
|
|
2618
2658
|
if (redirect2.response.headers.has("X-Remix-Reload-Document")) {
|
|
2619
2659
|
isDocumentReload = true;
|
|
@@ -2688,6 +2728,21 @@ function createRouter(init) {
|
|
|
2688
2728
|
if (request.signal.aborted) {
|
|
2689
2729
|
return dataResults;
|
|
2690
2730
|
}
|
|
2731
|
+
if (!isMutationMethod(request.method)) {
|
|
2732
|
+
for (let match of matches) {
|
|
2733
|
+
if (_optionalChain([results, 'access', _23 => _23[match.route.id], 'optionalAccess', _24 => _24.type]) === "error" /* error */) {
|
|
2734
|
+
break;
|
|
2735
|
+
}
|
|
2736
|
+
if (!results.hasOwnProperty(match.route.id) && !state.loaderData.hasOwnProperty(match.route.id) && (!state.errors || !state.errors.hasOwnProperty(match.route.id)) && match.shouldCallHandler()) {
|
|
2737
|
+
results[match.route.id] = {
|
|
2738
|
+
type: "error" /* error */,
|
|
2739
|
+
result: new Error(
|
|
2740
|
+
`No result returned from dataStrategy for route ${match.route.id}`
|
|
2741
|
+
)
|
|
2742
|
+
};
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
}
|
|
2691
2746
|
for (let [routeId, result] of Object.entries(results)) {
|
|
2692
2747
|
if (isRedirectDataStrategyResult(result)) {
|
|
2693
2748
|
let response = result.result;
|
|
@@ -2784,7 +2839,7 @@ function createRouter(init) {
|
|
|
2784
2839
|
return state.fetchers.get(key) || IDLE_FETCHER;
|
|
2785
2840
|
}
|
|
2786
2841
|
function resetFetcher(key, opts) {
|
|
2787
|
-
abortFetcher(key, _optionalChain([opts, 'optionalAccess',
|
|
2842
|
+
abortFetcher(key, _optionalChain([opts, 'optionalAccess', _25 => _25.reason]));
|
|
2788
2843
|
updateFetcherState(key, getDoneFetcher(null));
|
|
2789
2844
|
}
|
|
2790
2845
|
function deleteFetcher(key) {
|
|
@@ -3125,9 +3180,9 @@ function createStaticHandler(routes, opts) {
|
|
|
3125
3180
|
);
|
|
3126
3181
|
let manifest = {};
|
|
3127
3182
|
let basename = (opts ? opts.basename : null) || "/";
|
|
3128
|
-
let _mapRouteProperties = _optionalChain([opts, 'optionalAccess',
|
|
3183
|
+
let _mapRouteProperties = _optionalChain([opts, 'optionalAccess', _26 => _26.mapRouteProperties]) || defaultMapRouteProperties;
|
|
3129
3184
|
let mapRouteProperties2 = _mapRouteProperties;
|
|
3130
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
3185
|
+
if (_optionalChain([opts, 'optionalAccess', _27 => _27.unstable_instrumentations])) {
|
|
3131
3186
|
let instrumentations = opts.unstable_instrumentations;
|
|
3132
3187
|
mapRouteProperties2 = (route) => {
|
|
3133
3188
|
return {
|
|
@@ -3272,9 +3327,9 @@ function createStaticHandler(routes, opts) {
|
|
|
3272
3327
|
} else {
|
|
3273
3328
|
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
3274
3329
|
matches,
|
|
3275
|
-
_optionalChain([matches, 'access',
|
|
3330
|
+
_optionalChain([matches, 'access', _28 => _28.find, 'call', _29 => _29(
|
|
3276
3331
|
(m) => m.route.id === routeId || m.route.loader
|
|
3277
|
-
), 'optionalAccess',
|
|
3332
|
+
), 'optionalAccess', _30 => _30.route, 'access', _31 => _31.id]) || routeId
|
|
3278
3333
|
).route.id;
|
|
3279
3334
|
let staticContext = {
|
|
3280
3335
|
matches,
|
|
@@ -3607,11 +3662,11 @@ function createStaticHandler(routes, opts) {
|
|
|
3607
3662
|
}
|
|
3608
3663
|
async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, pendingActionResult) {
|
|
3609
3664
|
let isRouteRequest = routeMatch != null;
|
|
3610
|
-
if (isRouteRequest && !_optionalChain([routeMatch, 'optionalAccess',
|
|
3665
|
+
if (isRouteRequest && !_optionalChain([routeMatch, 'optionalAccess', _32 => _32.route, 'access', _33 => _33.loader]) && !_optionalChain([routeMatch, 'optionalAccess', _34 => _34.route, 'access', _35 => _35.lazy])) {
|
|
3611
3666
|
throw getInternalRouterError(400, {
|
|
3612
3667
|
method: request.method,
|
|
3613
3668
|
pathname: new URL(request.url).pathname,
|
|
3614
|
-
routeId: _optionalChain([routeMatch, 'optionalAccess',
|
|
3669
|
+
routeId: _optionalChain([routeMatch, 'optionalAccess', _36 => _36.route, 'access', _37 => _37.id])
|
|
3615
3670
|
});
|
|
3616
3671
|
}
|
|
3617
3672
|
let dsMatches;
|
|
@@ -3906,7 +3961,7 @@ function normalizeNavigateOptions(isFetcher, path, opts) {
|
|
|
3906
3961
|
parsedPath.search = `?${searchParams}`;
|
|
3907
3962
|
return { path: createPath(parsedPath), submission };
|
|
3908
3963
|
}
|
|
3909
|
-
function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest, history, state, matches, submission, location, lazyRoutePropertiesToSkip, initialHydration, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, hasPatchRoutesOnNavigation, pendingActionResult) {
|
|
3964
|
+
function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest, history, state, matches, submission, location, lazyRoutePropertiesToSkip, initialHydration, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, hasPatchRoutesOnNavigation, pendingActionResult, callSiteDefaultShouldRevalidate) {
|
|
3910
3965
|
let actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : void 0;
|
|
3911
3966
|
let currentUrl = history.createURL(state.location);
|
|
3912
3967
|
let nextUrl = history.createURL(location);
|
|
@@ -3922,7 +3977,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
|
|
|
3922
3977
|
let shouldSkipRevalidation = actionStatus && actionStatus >= 400;
|
|
3923
3978
|
let baseShouldRevalidateArgs = {
|
|
3924
3979
|
currentUrl,
|
|
3925
|
-
currentParams: _optionalChain([state, 'access',
|
|
3980
|
+
currentParams: _optionalChain([state, 'access', _38 => _38.matches, 'access', _39 => _39[0], 'optionalAccess', _40 => _40.params]) || {},
|
|
3926
3981
|
nextUrl,
|
|
3927
3982
|
nextParams: matches[0].params,
|
|
3928
3983
|
...submission,
|
|
@@ -3960,11 +4015,20 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
|
|
|
3960
4015
|
forceShouldLoad
|
|
3961
4016
|
);
|
|
3962
4017
|
}
|
|
3963
|
-
let defaultShouldRevalidate =
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
4018
|
+
let defaultShouldRevalidate = false;
|
|
4019
|
+
if (typeof callSiteDefaultShouldRevalidate === "boolean") {
|
|
4020
|
+
defaultShouldRevalidate = callSiteDefaultShouldRevalidate;
|
|
4021
|
+
} else if (shouldSkipRevalidation) {
|
|
4022
|
+
defaultShouldRevalidate = false;
|
|
4023
|
+
} else if (isRevalidationRequired) {
|
|
4024
|
+
defaultShouldRevalidate = true;
|
|
4025
|
+
} else if (currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search) {
|
|
4026
|
+
defaultShouldRevalidate = true;
|
|
4027
|
+
} else if (currentUrl.search !== nextUrl.search) {
|
|
4028
|
+
defaultShouldRevalidate = true;
|
|
4029
|
+
} else if (isNewRouteInstance(state.matches[index], match)) {
|
|
4030
|
+
defaultShouldRevalidate = true;
|
|
4031
|
+
}
|
|
3968
4032
|
let shouldRevalidateArgs = {
|
|
3969
4033
|
...baseShouldRevalidateArgs,
|
|
3970
4034
|
defaultShouldRevalidate
|
|
@@ -3979,7 +4043,8 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
|
|
|
3979
4043
|
lazyRoutePropertiesToSkip,
|
|
3980
4044
|
scopedContext,
|
|
3981
4045
|
shouldLoad,
|
|
3982
|
-
shouldRevalidateArgs
|
|
4046
|
+
shouldRevalidateArgs,
|
|
4047
|
+
callSiteDefaultShouldRevalidate
|
|
3983
4048
|
);
|
|
3984
4049
|
});
|
|
3985
4050
|
let revalidatingFetchers = [];
|
|
@@ -4040,9 +4105,17 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
|
|
|
4040
4105
|
);
|
|
4041
4106
|
}
|
|
4042
4107
|
} else {
|
|
4108
|
+
let defaultShouldRevalidate;
|
|
4109
|
+
if (typeof callSiteDefaultShouldRevalidate === "boolean") {
|
|
4110
|
+
defaultShouldRevalidate = callSiteDefaultShouldRevalidate;
|
|
4111
|
+
} else if (shouldSkipRevalidation) {
|
|
4112
|
+
defaultShouldRevalidate = false;
|
|
4113
|
+
} else {
|
|
4114
|
+
defaultShouldRevalidate = isRevalidationRequired;
|
|
4115
|
+
}
|
|
4043
4116
|
let shouldRevalidateArgs = {
|
|
4044
4117
|
...baseShouldRevalidateArgs,
|
|
4045
|
-
defaultShouldRevalidate
|
|
4118
|
+
defaultShouldRevalidate
|
|
4046
4119
|
};
|
|
4047
4120
|
if (shouldRevalidateLoader(fetcherMatch, shouldRevalidateArgs)) {
|
|
4048
4121
|
fetcherDsMatches = getTargetedDataStrategyMatches(
|
|
@@ -4149,7 +4222,7 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
|
|
|
4149
4222
|
let newRoutes = convertRoutesToDataRoutes(
|
|
4150
4223
|
uniqueChildren,
|
|
4151
4224
|
mapRouteProperties2,
|
|
4152
|
-
[routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess',
|
|
4225
|
+
[routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess', _41 => _41.length]) || "0")],
|
|
4153
4226
|
manifest
|
|
4154
4227
|
);
|
|
4155
4228
|
childrenToPatch.push(...newRoutes);
|
|
@@ -4186,7 +4259,7 @@ function isSameRoute(newRoute, existingRoute) {
|
|
|
4186
4259
|
return true;
|
|
4187
4260
|
}
|
|
4188
4261
|
return newRoute.children.every(
|
|
4189
|
-
(aChild, i) => _optionalChain([existingRoute, 'access',
|
|
4262
|
+
(aChild, i) => _optionalChain([existingRoute, 'access', _42 => _42.children, 'optionalAccess', _43 => _43.some, 'call', _44 => _44((bChild) => isSameRoute(aChild, bChild))])
|
|
4190
4263
|
);
|
|
4191
4264
|
}
|
|
4192
4265
|
var lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -4334,9 +4407,9 @@ function loadLazyRoute(route, type, manifest, mapRouteProperties2, lazyRouteProp
|
|
|
4334
4407
|
}
|
|
4335
4408
|
let lazyRoutePromise = lazyPropertyPromises.length > 0 ? Promise.all(lazyPropertyPromises).then(() => {
|
|
4336
4409
|
}) : void 0;
|
|
4337
|
-
_optionalChain([lazyRoutePromise, 'optionalAccess',
|
|
4410
|
+
_optionalChain([lazyRoutePromise, 'optionalAccess', _45 => _45.catch, 'call', _46 => _46(() => {
|
|
4338
4411
|
})]);
|
|
4339
|
-
_optionalChain([lazyHandlerPromise, 'optionalAccess',
|
|
4412
|
+
_optionalChain([lazyHandlerPromise, 'optionalAccess', _47 => _47.catch, 'call', _48 => _48(() => {
|
|
4340
4413
|
})]);
|
|
4341
4414
|
return {
|
|
4342
4415
|
lazyRoutePromise,
|
|
@@ -4391,8 +4464,12 @@ function runClientMiddlewarePipeline(args, handler) {
|
|
|
4391
4464
|
return runMiddlewarePipeline(
|
|
4392
4465
|
args,
|
|
4393
4466
|
handler,
|
|
4394
|
-
(r) =>
|
|
4395
|
-
|
|
4467
|
+
(r) => {
|
|
4468
|
+
if (isRedirectResponse(r)) {
|
|
4469
|
+
throw r;
|
|
4470
|
+
}
|
|
4471
|
+
return r;
|
|
4472
|
+
},
|
|
4396
4473
|
isDataStrategyResults,
|
|
4397
4474
|
errorHandler
|
|
4398
4475
|
);
|
|
@@ -4516,7 +4593,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties2, manifest, request
|
|
|
4516
4593
|
handler: lazyRoutePromises.lazyHandlerPromise
|
|
4517
4594
|
};
|
|
4518
4595
|
}
|
|
4519
|
-
function getDataStrategyMatch(mapRouteProperties2, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null) {
|
|
4596
|
+
function getDataStrategyMatch(mapRouteProperties2, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
|
|
4520
4597
|
let isUsingNewApi = false;
|
|
4521
4598
|
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
|
4522
4599
|
mapRouteProperties2,
|
|
@@ -4535,6 +4612,12 @@ function getDataStrategyMatch(mapRouteProperties2, manifest, request, unstable_p
|
|
|
4535
4612
|
if (!shouldRevalidateArgs) {
|
|
4536
4613
|
return shouldLoad;
|
|
4537
4614
|
}
|
|
4615
|
+
if (typeof callSiteDefaultShouldRevalidate === "boolean") {
|
|
4616
|
+
return shouldRevalidateLoader(match, {
|
|
4617
|
+
...shouldRevalidateArgs,
|
|
4618
|
+
defaultShouldRevalidate: callSiteDefaultShouldRevalidate
|
|
4619
|
+
});
|
|
4620
|
+
}
|
|
4538
4621
|
if (typeof defaultShouldRevalidate === "boolean") {
|
|
4539
4622
|
return shouldRevalidateLoader(match, {
|
|
4540
4623
|
...shouldRevalidateArgs,
|
|
@@ -4552,8 +4635,8 @@ function getDataStrategyMatch(mapRouteProperties2, manifest, request, unstable_p
|
|
|
4552
4635
|
request,
|
|
4553
4636
|
unstable_pattern,
|
|
4554
4637
|
match,
|
|
4555
|
-
lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess',
|
|
4556
|
-
lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess',
|
|
4638
|
+
lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess', _49 => _49.handler]),
|
|
4639
|
+
lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess', _50 => _50.route]),
|
|
4557
4640
|
handlerOverride,
|
|
4558
4641
|
scopedContext
|
|
4559
4642
|
});
|
|
@@ -4594,8 +4677,8 @@ function getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request,
|
|
|
4594
4677
|
});
|
|
4595
4678
|
}
|
|
4596
4679
|
async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherKey, scopedContext, isStaticHandler) {
|
|
4597
|
-
if (matches.some((m) => _optionalChain([m, 'access',
|
|
4598
|
-
await Promise.all(matches.map((m) => _optionalChain([m, 'access',
|
|
4680
|
+
if (matches.some((m) => _optionalChain([m, 'access', _51 => _51._lazyPromises, 'optionalAccess', _52 => _52.middleware]))) {
|
|
4681
|
+
await Promise.all(matches.map((m) => _optionalChain([m, 'access', _53 => _53._lazyPromises, 'optionalAccess', _54 => _54.middleware])));
|
|
4599
4682
|
}
|
|
4600
4683
|
let dataStrategyArgs = {
|
|
4601
4684
|
request,
|
|
@@ -4630,8 +4713,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4630
4713
|
try {
|
|
4631
4714
|
await Promise.all(
|
|
4632
4715
|
matches.flatMap((m) => [
|
|
4633
|
-
_optionalChain([m, 'access',
|
|
4634
|
-
_optionalChain([m, 'access',
|
|
4716
|
+
_optionalChain([m, 'access', _55 => _55._lazyPromises, 'optionalAccess', _56 => _56.handler]),
|
|
4717
|
+
_optionalChain([m, 'access', _57 => _57._lazyPromises, 'optionalAccess', _58 => _58.route])
|
|
4635
4718
|
])
|
|
4636
4719
|
);
|
|
4637
4720
|
} catch (e) {
|
|
@@ -4776,15 +4859,15 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4776
4859
|
return {
|
|
4777
4860
|
type: "error" /* error */,
|
|
4778
4861
|
error: result.data,
|
|
4779
|
-
statusCode: _optionalChain([result, 'access',
|
|
4780
|
-
headers: _optionalChain([result, 'access',
|
|
4862
|
+
statusCode: _optionalChain([result, 'access', _59 => _59.init, 'optionalAccess', _60 => _60.status]),
|
|
4863
|
+
headers: _optionalChain([result, 'access', _61 => _61.init, 'optionalAccess', _62 => _62.headers]) ? new Headers(result.init.headers) : void 0
|
|
4781
4864
|
};
|
|
4782
4865
|
}
|
|
4783
4866
|
return {
|
|
4784
4867
|
type: "error" /* error */,
|
|
4785
4868
|
error: dataWithResponseInitToErrorResponse(result),
|
|
4786
4869
|
statusCode: isRouteErrorResponse(result) ? result.status : void 0,
|
|
4787
|
-
headers: _optionalChain([result, 'access',
|
|
4870
|
+
headers: _optionalChain([result, 'access', _63 => _63.init, 'optionalAccess', _64 => _64.headers]) ? new Headers(result.init.headers) : void 0
|
|
4788
4871
|
};
|
|
4789
4872
|
}
|
|
4790
4873
|
return {
|
|
@@ -4797,8 +4880,8 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4797
4880
|
return {
|
|
4798
4881
|
type: "data" /* data */,
|
|
4799
4882
|
data: result.data,
|
|
4800
|
-
statusCode: _optionalChain([result, 'access',
|
|
4801
|
-
headers: _optionalChain([result, 'access',
|
|
4883
|
+
statusCode: _optionalChain([result, 'access', _65 => _65.init, 'optionalAccess', _66 => _66.status]),
|
|
4884
|
+
headers: _optionalChain([result, 'access', _67 => _67.init, 'optionalAccess', _68 => _68.headers]) ? new Headers(result.init.headers) : void 0
|
|
4802
4885
|
};
|
|
4803
4886
|
}
|
|
4804
4887
|
return { type: "data" /* data */, data: result };
|
|
@@ -4947,7 +5030,7 @@ function processLoaderData(state, matches, results, pendingActionResult, revalid
|
|
|
4947
5030
|
let result = fetcherResults[key];
|
|
4948
5031
|
invariant(result, "Did not find corresponding fetcher result");
|
|
4949
5032
|
if (isErrorResult(result)) {
|
|
4950
|
-
let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess',
|
|
5033
|
+
let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess', _69 => _69.route, 'access', _70 => _70.id]));
|
|
4951
5034
|
if (!(errors && errors[boundaryMatch.route.id])) {
|
|
4952
5035
|
errors = {
|
|
4953
5036
|
...errors,
|
|
@@ -5081,8 +5164,8 @@ function dataWithResponseInitToResponse(data2) {
|
|
|
5081
5164
|
}
|
|
5082
5165
|
function dataWithResponseInitToErrorResponse(data2) {
|
|
5083
5166
|
return new ErrorResponseImpl(
|
|
5084
|
-
_nullishCoalesce(_optionalChain([data2, 'access',
|
|
5085
|
-
_nullishCoalesce(_optionalChain([data2, 'access',
|
|
5167
|
+
_nullishCoalesce(_optionalChain([data2, 'access', _71 => _71.init, 'optionalAccess', _72 => _72.status]), () => ( 500)),
|
|
5168
|
+
_nullishCoalesce(_optionalChain([data2, 'access', _73 => _73.init, 'optionalAccess', _74 => _74.statusText]), () => ( "Internal Server Error")),
|
|
5086
5169
|
data2.data
|
|
5087
5170
|
);
|
|
5088
5171
|
}
|
|
@@ -6114,7 +6197,7 @@ function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules
|
|
|
6114
6197
|
return {
|
|
6115
6198
|
hasLoader: manifestRoute.hasLoader,
|
|
6116
6199
|
hasClientLoader: manifestRoute.hasClientLoader,
|
|
6117
|
-
hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess',
|
|
6200
|
+
hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess', _75 => _75.shouldRevalidate]))
|
|
6118
6201
|
};
|
|
6119
6202
|
},
|
|
6120
6203
|
fetchAndDecodeViaTurboStream,
|
|
@@ -6279,7 +6362,7 @@ async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams,
|
|
|
6279
6362
|
let routeResult = fetchedData.routes[match.route.id];
|
|
6280
6363
|
if ("error" in routeResult) {
|
|
6281
6364
|
middlewareError = routeResult.error;
|
|
6282
|
-
if (_optionalChain([results, 'access',
|
|
6365
|
+
if (_optionalChain([results, 'access', _76 => _76[match.route.id], 'optionalAccess', _77 => _77.result]) == null) {
|
|
6283
6366
|
results[match.route.id] = {
|
|
6284
6367
|
type: "error",
|
|
6285
6368
|
result: middlewareError
|
|
@@ -6392,7 +6475,7 @@ async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
|
|
|
6392
6475
|
}
|
|
6393
6476
|
} else {
|
|
6394
6477
|
let typed = decoded.value;
|
|
6395
|
-
let routeId = _optionalChain([targetRoutes, 'optionalAccess',
|
|
6478
|
+
let routeId = _optionalChain([targetRoutes, 'optionalAccess', _78 => _78[0]]);
|
|
6396
6479
|
invariant2(routeId, "No routeId found for single fetch call decoding");
|
|
6397
6480
|
if ("redirect" in typed) {
|
|
6398
6481
|
data2 = { redirect: typed };
|
|
@@ -6539,6 +6622,41 @@ var ENABLE_DEV_WARNINGS = true;
|
|
|
6539
6622
|
|
|
6540
6623
|
// lib/hooks.tsx
|
|
6541
6624
|
|
|
6625
|
+
|
|
6626
|
+
// lib/errors.ts
|
|
6627
|
+
var ERROR_DIGEST_BASE = "REACT_ROUTER_ERROR";
|
|
6628
|
+
var ERROR_DIGEST_REDIRECT = "REDIRECT";
|
|
6629
|
+
var ERROR_DIGEST_ROUTE_ERROR_RESPONSE = "ROUTE_ERROR_RESPONSE";
|
|
6630
|
+
function decodeRedirectErrorDigest(digest) {
|
|
6631
|
+
if (digest.startsWith(`${ERROR_DIGEST_BASE}:${ERROR_DIGEST_REDIRECT}:{`)) {
|
|
6632
|
+
try {
|
|
6633
|
+
let parsed = JSON.parse(digest.slice(28));
|
|
6634
|
+
if (typeof parsed === "object" && parsed && typeof parsed.status === "number" && typeof parsed.statusText === "string" && typeof parsed.location === "string" && typeof parsed.reloadDocument === "boolean" && typeof parsed.replace === "boolean") {
|
|
6635
|
+
return parsed;
|
|
6636
|
+
}
|
|
6637
|
+
} catch (e2) {
|
|
6638
|
+
}
|
|
6639
|
+
}
|
|
6640
|
+
}
|
|
6641
|
+
function decodeRouteErrorResponseDigest(digest) {
|
|
6642
|
+
if (digest.startsWith(
|
|
6643
|
+
`${ERROR_DIGEST_BASE}:${ERROR_DIGEST_ROUTE_ERROR_RESPONSE}:{`
|
|
6644
|
+
)) {
|
|
6645
|
+
try {
|
|
6646
|
+
let parsed = JSON.parse(digest.slice(40));
|
|
6647
|
+
if (typeof parsed === "object" && parsed && typeof parsed.status === "number" && typeof parsed.statusText === "string") {
|
|
6648
|
+
return new ErrorResponseImpl(
|
|
6649
|
+
parsed.status,
|
|
6650
|
+
parsed.statusText,
|
|
6651
|
+
parsed.data
|
|
6652
|
+
);
|
|
6653
|
+
}
|
|
6654
|
+
} catch (e3) {
|
|
6655
|
+
}
|
|
6656
|
+
}
|
|
6657
|
+
}
|
|
6658
|
+
|
|
6659
|
+
// lib/hooks.tsx
|
|
6542
6660
|
function useHref(to, { relative } = {}) {
|
|
6543
6661
|
invariant(
|
|
6544
6662
|
useInRouterContext(),
|
|
@@ -6675,7 +6793,7 @@ function useResolvedPath(to, { relative } = {}) {
|
|
|
6675
6793
|
function useRoutes(routes, locationArg) {
|
|
6676
6794
|
return useRoutesImpl(routes, locationArg);
|
|
6677
6795
|
}
|
|
6678
|
-
function useRoutesImpl(routes, locationArg, dataRouterState,
|
|
6796
|
+
function useRoutesImpl(routes, locationArg, dataRouterState, onError, future) {
|
|
6679
6797
|
invariant(
|
|
6680
6798
|
useInRouterContext(),
|
|
6681
6799
|
// TODO: This error is probably because they somehow have 2 versions of the
|
|
@@ -6704,7 +6822,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
6704
6822
|
if (locationArg) {
|
|
6705
6823
|
let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
6706
6824
|
invariant(
|
|
6707
|
-
parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access',
|
|
6825
|
+
parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _79 => _79.pathname, 'optionalAccess', _80 => _80.startsWith, 'call', _81 => _81(parentPathnameBase)]),
|
|
6708
6826
|
`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.`
|
|
6709
6827
|
);
|
|
6710
6828
|
location = parsedLocationArg;
|
|
@@ -6757,7 +6875,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
6757
6875
|
),
|
|
6758
6876
|
parentMatches,
|
|
6759
6877
|
dataRouterState,
|
|
6760
|
-
|
|
6878
|
+
onError,
|
|
6761
6879
|
future
|
|
6762
6880
|
);
|
|
6763
6881
|
if (locationArg && renderedMatches) {
|
|
@@ -6836,15 +6954,61 @@ var RenderErrorBoundary = class extends React3.Component {
|
|
|
6836
6954
|
}
|
|
6837
6955
|
}
|
|
6838
6956
|
render() {
|
|
6839
|
-
|
|
6957
|
+
let error = this.state.error;
|
|
6958
|
+
if (this.context && typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
|
|
6959
|
+
const decoded = decodeRouteErrorResponseDigest(error.digest);
|
|
6960
|
+
if (decoded) error = decoded;
|
|
6961
|
+
}
|
|
6962
|
+
let result = error !== void 0 ? /* @__PURE__ */ React3.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ React3.createElement(
|
|
6840
6963
|
RouteErrorContext.Provider,
|
|
6841
6964
|
{
|
|
6842
|
-
value:
|
|
6965
|
+
value: error,
|
|
6843
6966
|
children: this.props.component
|
|
6844
6967
|
}
|
|
6845
6968
|
)) : this.props.children;
|
|
6969
|
+
if (this.context) {
|
|
6970
|
+
return /* @__PURE__ */ React3.createElement(RSCErrorHandler, { error }, result);
|
|
6971
|
+
}
|
|
6972
|
+
return result;
|
|
6846
6973
|
}
|
|
6847
6974
|
};
|
|
6975
|
+
RenderErrorBoundary.contextType = RSCRouterContext;
|
|
6976
|
+
var errorRedirectHandledMap = /* @__PURE__ */ new WeakMap();
|
|
6977
|
+
function RSCErrorHandler({
|
|
6978
|
+
children,
|
|
6979
|
+
error
|
|
6980
|
+
}) {
|
|
6981
|
+
let { basename } = React3.useContext(NavigationContext);
|
|
6982
|
+
if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
|
|
6983
|
+
let redirect2 = decodeRedirectErrorDigest(error.digest);
|
|
6984
|
+
if (redirect2) {
|
|
6985
|
+
let existingRedirect = errorRedirectHandledMap.get(error);
|
|
6986
|
+
if (existingRedirect) throw existingRedirect;
|
|
6987
|
+
let parsed = parseToInfo(redirect2.location, basename);
|
|
6988
|
+
if (isBrowser && !errorRedirectHandledMap.get(error)) {
|
|
6989
|
+
if (parsed.isExternal || redirect2.reloadDocument) {
|
|
6990
|
+
window.location.href = parsed.absoluteURL || parsed.to;
|
|
6991
|
+
} else {
|
|
6992
|
+
const redirectPromise = Promise.resolve().then(
|
|
6993
|
+
() => window.__reactRouterDataRouter.navigate(parsed.to, {
|
|
6994
|
+
replace: redirect2.replace
|
|
6995
|
+
})
|
|
6996
|
+
);
|
|
6997
|
+
errorRedirectHandledMap.set(error, redirectPromise);
|
|
6998
|
+
throw redirectPromise;
|
|
6999
|
+
}
|
|
7000
|
+
}
|
|
7001
|
+
return /* @__PURE__ */ React3.createElement(
|
|
7002
|
+
"meta",
|
|
7003
|
+
{
|
|
7004
|
+
httpEquiv: "refresh",
|
|
7005
|
+
content: `0;url=${parsed.absoluteURL || parsed.to}`
|
|
7006
|
+
}
|
|
7007
|
+
);
|
|
7008
|
+
}
|
|
7009
|
+
}
|
|
7010
|
+
return children;
|
|
7011
|
+
}
|
|
6848
7012
|
function RenderedRoute({ routeContext, match, children }) {
|
|
6849
7013
|
let dataRouterContext = React3.useContext(DataRouterContext);
|
|
6850
7014
|
if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {
|
|
@@ -6852,7 +7016,7 @@ function RenderedRoute({ routeContext, match, children }) {
|
|
|
6852
7016
|
}
|
|
6853
7017
|
return /* @__PURE__ */ React3.createElement(RouteContext.Provider, { value: routeContext }, children);
|
|
6854
7018
|
}
|
|
6855
|
-
function _renderMatches(matches, parentMatches = [], dataRouterState = null,
|
|
7019
|
+
function _renderMatches(matches, parentMatches = [], dataRouterState = null, onErrorHandler = null, future = null) {
|
|
6856
7020
|
if (matches == null) {
|
|
6857
7021
|
if (!dataRouterState) {
|
|
6858
7022
|
return null;
|
|
@@ -6866,10 +7030,10 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
|
|
|
6866
7030
|
}
|
|
6867
7031
|
}
|
|
6868
7032
|
let renderedMatches = matches;
|
|
6869
|
-
let errors = _optionalChain([dataRouterState, 'optionalAccess',
|
|
7033
|
+
let errors = _optionalChain([dataRouterState, 'optionalAccess', _82 => _82.errors]);
|
|
6870
7034
|
if (errors != null) {
|
|
6871
7035
|
let errorIndex = renderedMatches.findIndex(
|
|
6872
|
-
(m) => m.route.id && _optionalChain([errors, 'optionalAccess',
|
|
7036
|
+
(m) => m.route.id && _optionalChain([errors, 'optionalAccess', _83 => _83[m.route.id]]) !== void 0
|
|
6873
7037
|
);
|
|
6874
7038
|
invariant(
|
|
6875
7039
|
errorIndex >= 0,
|
|
@@ -6905,10 +7069,10 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
|
|
|
6905
7069
|
}
|
|
6906
7070
|
}
|
|
6907
7071
|
}
|
|
6908
|
-
let onError = dataRouterState &&
|
|
6909
|
-
|
|
7072
|
+
let onError = dataRouterState && onErrorHandler ? (error, errorInfo) => {
|
|
7073
|
+
onErrorHandler(error, {
|
|
6910
7074
|
location: dataRouterState.location,
|
|
6911
|
-
params: _nullishCoalesce(_optionalChain([dataRouterState, 'access',
|
|
7075
|
+
params: _nullishCoalesce(_optionalChain([dataRouterState, 'access', _84 => _84.matches, 'optionalAccess', _85 => _85[0], 'optionalAccess', _86 => _86.params]), () => ( {})),
|
|
6912
7076
|
unstable_pattern: getRoutePattern(dataRouterState.matches),
|
|
6913
7077
|
errorInfo
|
|
6914
7078
|
});
|
|
@@ -7055,15 +7219,15 @@ function useRouteError() {
|
|
|
7055
7219
|
if (error !== void 0) {
|
|
7056
7220
|
return error;
|
|
7057
7221
|
}
|
|
7058
|
-
return _optionalChain([state, 'access',
|
|
7222
|
+
return _optionalChain([state, 'access', _87 => _87.errors, 'optionalAccess', _88 => _88[routeId]]);
|
|
7059
7223
|
}
|
|
7060
7224
|
function useAsyncValue() {
|
|
7061
7225
|
let value = React3.useContext(AwaitContext);
|
|
7062
|
-
return _optionalChain([value, 'optionalAccess',
|
|
7226
|
+
return _optionalChain([value, 'optionalAccess', _89 => _89._data]);
|
|
7063
7227
|
}
|
|
7064
7228
|
function useAsyncError() {
|
|
7065
7229
|
let value = React3.useContext(AwaitContext);
|
|
7066
|
-
return _optionalChain([value, 'optionalAccess',
|
|
7230
|
+
return _optionalChain([value, 'optionalAccess', _90 => _90._error]);
|
|
7067
7231
|
}
|
|
7068
7232
|
var blockerId = 0;
|
|
7069
7233
|
function useBlocker(shouldBlock) {
|
|
@@ -7144,7 +7308,7 @@ function useRoute(...args) {
|
|
|
7144
7308
|
return {
|
|
7145
7309
|
handle: route.route.handle,
|
|
7146
7310
|
loaderData: state.loaderData[id],
|
|
7147
|
-
actionData: _optionalChain([state, 'access',
|
|
7311
|
+
actionData: _optionalChain([state, 'access', _91 => _91.actionData, 'optionalAccess', _92 => _92[id]])
|
|
7148
7312
|
};
|
|
7149
7313
|
}
|
|
7150
7314
|
|
|
@@ -7189,7 +7353,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
7189
7353
|
let route = manifest.routes[match.route.id];
|
|
7190
7354
|
return [
|
|
7191
7355
|
route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
|
|
7192
|
-
_optionalChain([module, 'optionalAccess',
|
|
7356
|
+
_optionalChain([module, 'optionalAccess', _93 => _93.links, 'optionalCall', _94 => _94()]) || []
|
|
7193
7357
|
];
|
|
7194
7358
|
}).flat(2);
|
|
7195
7359
|
let preloads = getModuleLinkHrefs(matches, manifest);
|
|
@@ -7290,7 +7454,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
7290
7454
|
// param change, /users/123 -> /users/456
|
|
7291
7455
|
currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
|
|
7292
7456
|
// e.g. /files/images/avatar.jpg -> files/finances.xls
|
|
7293
|
-
_optionalChain([currentMatches, 'access',
|
|
7457
|
+
_optionalChain([currentMatches, 'access', _95 => _95[index], 'access', _96 => _96.route, 'access', _97 => _97.path, 'optionalAccess', _98 => _98.endsWith, 'call', _99 => _99("*")]) && currentMatches[index].params["*"] !== match.params["*"]
|
|
7294
7458
|
);
|
|
7295
7459
|
};
|
|
7296
7460
|
if (mode === "assets") {
|
|
@@ -7313,7 +7477,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
7313
7477
|
location.pathname + location.search + location.hash,
|
|
7314
7478
|
window.origin
|
|
7315
7479
|
),
|
|
7316
|
-
currentParams: _optionalChain([currentMatches, 'access',
|
|
7480
|
+
currentParams: _optionalChain([currentMatches, 'access', _100 => _100[0], 'optionalAccess', _101 => _101.params]) || {},
|
|
7317
7481
|
nextUrl: new URL(page, window.origin),
|
|
7318
7482
|
nextParams: match.params,
|
|
7319
7483
|
defaultShouldRevalidate: true
|
|
@@ -7585,10 +7749,10 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7585
7749
|
)
|
|
7586
7750
|
});
|
|
7587
7751
|
let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
|
|
7588
|
-
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess',
|
|
7752
|
+
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _102 => _102.loaderData, 'optionalAccess', _103 => _103[route.id]]) : void 0;
|
|
7589
7753
|
let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
|
|
7590
|
-
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess',
|
|
7591
|
-
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access',
|
|
7754
|
+
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _104 => _104.errors, 'optionalAccess', _105 => _105[route.id]]) : void 0;
|
|
7755
|
+
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _106 => _106.clientLoader, 'optionalAccess', _107 => _107.hydrate]) === true || !route.hasLoader);
|
|
7592
7756
|
dataRoute.loader = async ({ request, params, context, unstable_pattern }, singleFetch) => {
|
|
7593
7757
|
try {
|
|
7594
7758
|
let result = await prefetchStylesAndCallHandler(async () => {
|
|
@@ -7880,7 +8044,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
|
|
|
7880
8044
|
function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
|
|
7881
8045
|
React6.useEffect(() => {
|
|
7882
8046
|
if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
|
|
7883
|
-
_optionalChain([window, 'access',
|
|
8047
|
+
_optionalChain([window, 'access', _108 => _108.navigator, 'optionalAccess', _109 => _109.connection, 'optionalAccess', _110 => _110.saveData]) === true) {
|
|
7884
8048
|
return;
|
|
7885
8049
|
}
|
|
7886
8050
|
function registerElement(el) {
|
|
@@ -7974,7 +8138,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
|
|
|
7974
8138
|
return;
|
|
7975
8139
|
}
|
|
7976
8140
|
sessionStorage.setItem(MANIFEST_VERSION_STORAGE_KEY, manifest.version);
|
|
7977
|
-
} catch (
|
|
8141
|
+
} catch (e4) {
|
|
7978
8142
|
}
|
|
7979
8143
|
window.location.href = errorReloadPath;
|
|
7980
8144
|
console.warn("Detected manifest version mismatch, reloading...");
|
|
@@ -7985,11 +8149,11 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
|
|
|
7985
8149
|
}
|
|
7986
8150
|
try {
|
|
7987
8151
|
sessionStorage.removeItem(MANIFEST_VERSION_STORAGE_KEY);
|
|
7988
|
-
} catch (
|
|
8152
|
+
} catch (e5) {
|
|
7989
8153
|
}
|
|
7990
8154
|
serverPatches = await res.json();
|
|
7991
8155
|
} catch (e) {
|
|
7992
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
8156
|
+
if (_optionalChain([signal, 'optionalAccess', _111 => _111.aborted])) return;
|
|
7993
8157
|
throw e;
|
|
7994
8158
|
}
|
|
7995
8159
|
let knownRoutes = new Set(Object.keys(manifest.routes));
|
|
@@ -8230,7 +8394,7 @@ function PrefetchPageLinksImpl({
|
|
|
8230
8394
|
if (!manifestRoute || !manifestRoute.hasLoader) {
|
|
8231
8395
|
return;
|
|
8232
8396
|
}
|
|
8233
|
-
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access',
|
|
8397
|
+
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _112 => _112[m.route.id], 'optionalAccess', _113 => _113.shouldRevalidate])) {
|
|
8234
8398
|
foundOptOutRoute = true;
|
|
8235
8399
|
} else if (manifestRoute.hasClientLoader) {
|
|
8236
8400
|
foundOptOutRoute = true;
|
|
@@ -8304,7 +8468,7 @@ function Meta() {
|
|
|
8304
8468
|
error
|
|
8305
8469
|
};
|
|
8306
8470
|
matches[i] = match;
|
|
8307
|
-
if (_optionalChain([routeModule, 'optionalAccess',
|
|
8471
|
+
if (_optionalChain([routeModule, 'optionalAccess', _114 => _114.meta])) {
|
|
8308
8472
|
routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
|
|
8309
8473
|
data: data2,
|
|
8310
8474
|
loaderData: data2,
|
|
@@ -8403,7 +8567,7 @@ function Scripts(scriptProps) {
|
|
|
8403
8567
|
}
|
|
8404
8568
|
let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
|
|
8405
8569
|
let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
|
|
8406
|
-
let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access',
|
|
8570
|
+
let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _115 => _115.hmr, 'optionalAccess', _116 => _116.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
|
|
8407
8571
|
${matches.map((match, routeIndex) => {
|
|
8408
8572
|
let routeVarName = `route${routeIndex}`;
|
|
8409
8573
|
let manifestEntry = manifest.routes[match.route.id];
|
|
@@ -8633,7 +8797,7 @@ function BoundaryShell({
|
|
|
8633
8797
|
children
|
|
8634
8798
|
}) {
|
|
8635
8799
|
let { routeModules } = useFrameworkContext();
|
|
8636
|
-
if (_optionalChain([routeModules, 'access',
|
|
8800
|
+
if (_optionalChain([routeModules, 'access', _117 => _117.root, 'optionalAccess', _118 => _118.Layout]) && !isOutsideRemixApp) {
|
|
8637
8801
|
return children;
|
|
8638
8802
|
}
|
|
8639
8803
|
return /* @__PURE__ */ React8.createElement("html", { lang: "en" }, /* @__PURE__ */ React8.createElement("head", null, /* @__PURE__ */ React8.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React8.createElement(
|
|
@@ -8713,20 +8877,20 @@ var hydrationRouteProperties = [
|
|
|
8713
8877
|
];
|
|
8714
8878
|
function createMemoryRouter(routes, opts) {
|
|
8715
8879
|
return createRouter({
|
|
8716
|
-
basename: _optionalChain([opts, 'optionalAccess',
|
|
8717
|
-
getContext: _optionalChain([opts, 'optionalAccess',
|
|
8718
|
-
future: _optionalChain([opts, 'optionalAccess',
|
|
8880
|
+
basename: _optionalChain([opts, 'optionalAccess', _119 => _119.basename]),
|
|
8881
|
+
getContext: _optionalChain([opts, 'optionalAccess', _120 => _120.getContext]),
|
|
8882
|
+
future: _optionalChain([opts, 'optionalAccess', _121 => _121.future]),
|
|
8719
8883
|
history: createMemoryHistory({
|
|
8720
|
-
initialEntries: _optionalChain([opts, 'optionalAccess',
|
|
8721
|
-
initialIndex: _optionalChain([opts, 'optionalAccess',
|
|
8884
|
+
initialEntries: _optionalChain([opts, 'optionalAccess', _122 => _122.initialEntries]),
|
|
8885
|
+
initialIndex: _optionalChain([opts, 'optionalAccess', _123 => _123.initialIndex])
|
|
8722
8886
|
}),
|
|
8723
|
-
hydrationData: _optionalChain([opts, 'optionalAccess',
|
|
8887
|
+
hydrationData: _optionalChain([opts, 'optionalAccess', _124 => _124.hydrationData]),
|
|
8724
8888
|
routes,
|
|
8725
8889
|
hydrationRouteProperties,
|
|
8726
8890
|
mapRouteProperties,
|
|
8727
|
-
dataStrategy: _optionalChain([opts, 'optionalAccess',
|
|
8728
|
-
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess',
|
|
8729
|
-
unstable_instrumentations: _optionalChain([opts, 'optionalAccess',
|
|
8891
|
+
dataStrategy: _optionalChain([opts, 'optionalAccess', _125 => _125.dataStrategy]),
|
|
8892
|
+
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _126 => _126.patchRoutesOnNavigation]),
|
|
8893
|
+
unstable_instrumentations: _optionalChain([opts, 'optionalAccess', _127 => _127.unstable_instrumentations])
|
|
8730
8894
|
}).initialize();
|
|
8731
8895
|
}
|
|
8732
8896
|
var Deferred2 = class {
|
|
@@ -8751,9 +8915,11 @@ var Deferred2 = class {
|
|
|
8751
8915
|
function RouterProvider({
|
|
8752
8916
|
router,
|
|
8753
8917
|
flushSync: reactDomFlushSyncImpl,
|
|
8754
|
-
|
|
8918
|
+
onError,
|
|
8755
8919
|
unstable_useTransitions
|
|
8756
8920
|
}) {
|
|
8921
|
+
let unstable_rsc = useIsRSCRouterContext();
|
|
8922
|
+
unstable_useTransitions = unstable_rsc || unstable_useTransitions;
|
|
8757
8923
|
let [_state, setStateImpl] = React9.useState(router.state);
|
|
8758
8924
|
let [state, setOptimisticState] = useOptimisticSafe(_state);
|
|
8759
8925
|
let [pendingState, setPendingState] = React9.useState();
|
|
@@ -8766,11 +8932,11 @@ function RouterProvider({
|
|
|
8766
8932
|
let fetcherData = React9.useRef(/* @__PURE__ */ new Map());
|
|
8767
8933
|
let setState = React9.useCallback(
|
|
8768
8934
|
(newState, { deletedFetchers, newErrors, flushSync, viewTransitionOpts }) => {
|
|
8769
|
-
if (newErrors &&
|
|
8935
|
+
if (newErrors && onError) {
|
|
8770
8936
|
Object.values(newErrors).forEach(
|
|
8771
|
-
(error) =>
|
|
8937
|
+
(error) => onError(error, {
|
|
8772
8938
|
location: newState.location,
|
|
8773
|
-
params: _nullishCoalesce(_optionalChain([newState, 'access',
|
|
8939
|
+
params: _nullishCoalesce(_optionalChain([newState, 'access', _128 => _128.matches, 'access', _129 => _129[0], 'optionalAccess', _130 => _130.params]), () => ( {})),
|
|
8774
8940
|
unstable_pattern: getRoutePattern(newState.matches)
|
|
8775
8941
|
})
|
|
8776
8942
|
);
|
|
@@ -8808,7 +8974,7 @@ function RouterProvider({
|
|
|
8808
8974
|
if (reactDomFlushSyncImpl && flushSync) {
|
|
8809
8975
|
reactDomFlushSyncImpl(() => {
|
|
8810
8976
|
if (transition) {
|
|
8811
|
-
_optionalChain([renderDfd, 'optionalAccess',
|
|
8977
|
+
_optionalChain([renderDfd, 'optionalAccess', _131 => _131.resolve, 'call', _132 => _132()]);
|
|
8812
8978
|
transition.skipTransition();
|
|
8813
8979
|
}
|
|
8814
8980
|
setVtContext({
|
|
@@ -8833,7 +8999,7 @@ function RouterProvider({
|
|
|
8833
8999
|
return;
|
|
8834
9000
|
}
|
|
8835
9001
|
if (transition) {
|
|
8836
|
-
_optionalChain([renderDfd, 'optionalAccess',
|
|
9002
|
+
_optionalChain([renderDfd, 'optionalAccess', _133 => _133.resolve, 'call', _134 => _134()]);
|
|
8837
9003
|
transition.skipTransition();
|
|
8838
9004
|
setInterruption({
|
|
8839
9005
|
state: newState,
|
|
@@ -8857,7 +9023,7 @@ function RouterProvider({
|
|
|
8857
9023
|
renderDfd,
|
|
8858
9024
|
unstable_useTransitions,
|
|
8859
9025
|
setOptimisticState,
|
|
8860
|
-
|
|
9026
|
+
onError
|
|
8861
9027
|
]
|
|
8862
9028
|
);
|
|
8863
9029
|
React9.useLayoutEffect(() => router.subscribe(setState), [router, setState]);
|
|
@@ -8922,12 +9088,12 @@ function RouterProvider({
|
|
|
8922
9088
|
go: (n) => router.navigate(n),
|
|
8923
9089
|
push: (to, state2, opts) => router.navigate(to, {
|
|
8924
9090
|
state: state2,
|
|
8925
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess',
|
|
9091
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _135 => _135.preventScrollReset])
|
|
8926
9092
|
}),
|
|
8927
9093
|
replace: (to, state2, opts) => router.navigate(to, {
|
|
8928
9094
|
replace: true,
|
|
8929
9095
|
state: state2,
|
|
8930
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess',
|
|
9096
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _136 => _136.preventScrollReset])
|
|
8931
9097
|
})
|
|
8932
9098
|
};
|
|
8933
9099
|
}, [router]);
|
|
@@ -8938,9 +9104,9 @@ function RouterProvider({
|
|
|
8938
9104
|
navigator,
|
|
8939
9105
|
static: false,
|
|
8940
9106
|
basename,
|
|
8941
|
-
|
|
9107
|
+
onError
|
|
8942
9108
|
}),
|
|
8943
|
-
[router, navigator, basename,
|
|
9109
|
+
[router, navigator, basename, onError]
|
|
8944
9110
|
);
|
|
8945
9111
|
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React9.createElement(DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React9.createElement(FetchersContext.Provider, { value: fetcherData.current }, /* @__PURE__ */ React9.createElement(ViewTransitionContext.Provider, { value: vtContext }, /* @__PURE__ */ React9.createElement(
|
|
8946
9112
|
Router,
|
|
@@ -8949,7 +9115,7 @@ function RouterProvider({
|
|
|
8949
9115
|
location: state.location,
|
|
8950
9116
|
navigationType: state.historyAction,
|
|
8951
9117
|
navigator,
|
|
8952
|
-
unstable_useTransitions
|
|
9118
|
+
unstable_useTransitions
|
|
8953
9119
|
},
|
|
8954
9120
|
/* @__PURE__ */ React9.createElement(
|
|
8955
9121
|
MemoizedDataRoutes,
|
|
@@ -8957,7 +9123,7 @@ function RouterProvider({
|
|
|
8957
9123
|
routes: router.routes,
|
|
8958
9124
|
future: router.future,
|
|
8959
9125
|
state,
|
|
8960
|
-
|
|
9126
|
+
onError
|
|
8961
9127
|
}
|
|
8962
9128
|
)
|
|
8963
9129
|
))))), null);
|
|
@@ -8981,9 +9147,9 @@ function DataRoutes({
|
|
|
8981
9147
|
routes,
|
|
8982
9148
|
future,
|
|
8983
9149
|
state,
|
|
8984
|
-
|
|
9150
|
+
onError
|
|
8985
9151
|
}) {
|
|
8986
|
-
return useRoutesImpl(routes, void 0, state,
|
|
9152
|
+
return useRoutesImpl(routes, void 0, state, onError, future);
|
|
8987
9153
|
}
|
|
8988
9154
|
function MemoryRouter({
|
|
8989
9155
|
basename,
|
|
@@ -9024,7 +9190,7 @@ function MemoryRouter({
|
|
|
9024
9190
|
location: state.location,
|
|
9025
9191
|
navigationType: state.action,
|
|
9026
9192
|
navigator: history,
|
|
9027
|
-
unstable_useTransitions
|
|
9193
|
+
unstable_useTransitions
|
|
9028
9194
|
}
|
|
9029
9195
|
);
|
|
9030
9196
|
}
|
|
@@ -9143,10 +9309,10 @@ function Await({
|
|
|
9143
9309
|
let dataRouterStateContext = React9.useContext(DataRouterStateContext);
|
|
9144
9310
|
let onError = React9.useCallback(
|
|
9145
9311
|
(error, errorInfo) => {
|
|
9146
|
-
if (dataRouterContext && dataRouterContext.
|
|
9147
|
-
dataRouterContext.
|
|
9312
|
+
if (dataRouterContext && dataRouterContext.onError && dataRouterStateContext) {
|
|
9313
|
+
dataRouterContext.onError(error, {
|
|
9148
9314
|
location: dataRouterStateContext.location,
|
|
9149
|
-
params: _optionalChain([dataRouterStateContext, 'access',
|
|
9315
|
+
params: _optionalChain([dataRouterStateContext, 'access', _137 => _137.matches, 'access', _138 => _138[0], 'optionalAccess', _139 => _139.params]) || {},
|
|
9150
9316
|
unstable_pattern: getRoutePattern(dataRouterStateContext.matches),
|
|
9151
9317
|
errorInfo
|
|
9152
9318
|
});
|
|
@@ -9208,7 +9374,7 @@ var AwaitErrorBoundary = class extends React9.Component {
|
|
|
9208
9374
|
promise = resolve.then(
|
|
9209
9375
|
(data2) => Object.defineProperty(resolve, "_data", { get: () => data2 }),
|
|
9210
9376
|
(error) => {
|
|
9211
|
-
_optionalChain([this, 'access',
|
|
9377
|
+
_optionalChain([this, 'access', _140 => _140.props, 'access', _141 => _141.onError, 'optionalCall', _142 => _142(error)]);
|
|
9212
9378
|
Object.defineProperty(resolve, "_error", { get: () => error });
|
|
9213
9379
|
}
|
|
9214
9380
|
);
|
|
@@ -9467,4 +9633,7 @@ function withErrorBoundaryProps(ErrorBoundary) {
|
|
|
9467
9633
|
|
|
9468
9634
|
|
|
9469
9635
|
|
|
9470
|
-
|
|
9636
|
+
|
|
9637
|
+
|
|
9638
|
+
|
|
9639
|
+
exports.Action = Action; exports.createBrowserHistory = createBrowserHistory; exports.createHashHistory = createHashHistory; exports.invariant = invariant; exports.warning = warning; exports.createPath = createPath; exports.parsePath = parsePath; exports.createContext = createContext; exports.RouterContextProvider = RouterContextProvider; exports.convertRoutesToDataRoutes = convertRoutesToDataRoutes; exports.matchRoutes = matchRoutes; exports.generatePath = generatePath; exports.matchPath = matchPath; exports.stripBasename = stripBasename; exports.resolvePath = resolvePath; exports.joinPaths = joinPaths; exports.data = data; exports.redirect = redirect; exports.redirectDocument = redirectDocument; exports.replace = replace; exports.ErrorResponseImpl = ErrorResponseImpl; exports.isRouteErrorResponse = isRouteErrorResponse; exports.parseToInfo = parseToInfo; exports.escapeHtml = escapeHtml; exports.encode = encode; exports.instrumentHandler = instrumentHandler; exports.IDLE_NAVIGATION = IDLE_NAVIGATION; exports.IDLE_FETCHER = IDLE_FETCHER; exports.IDLE_BLOCKER = IDLE_BLOCKER; exports.createRouter = createRouter; exports.createStaticHandler = createStaticHandler; exports.getStaticContextFromError = getStaticContextFromError; exports.isDataWithResponseInit = isDataWithResponseInit; exports.isResponse = isResponse; exports.isRedirectStatusCode = isRedirectStatusCode; exports.isRedirectResponse = isRedirectResponse; exports.isMutationMethod = isMutationMethod; exports.createRequestInit = createRequestInit; exports.SingleFetchRedirectSymbol = SingleFetchRedirectSymbol; exports.SINGLE_FETCH_REDIRECT_STATUS = SINGLE_FETCH_REDIRECT_STATUS; exports.NO_BODY_STATUS_CODES = NO_BODY_STATUS_CODES; exports.StreamTransfer = StreamTransfer; exports.getTurboStreamSingleFetchDataStrategy = getTurboStreamSingleFetchDataStrategy; exports.getSingleFetchDataStrategyImpl = getSingleFetchDataStrategyImpl; exports.stripIndexParam = stripIndexParam; exports.singleFetchUrl = singleFetchUrl; exports.decodeViaTurboStream = decodeViaTurboStream; exports.DataRouterContext = DataRouterContext; exports.DataRouterStateContext = DataRouterStateContext; exports.RSCRouterContext = RSCRouterContext; exports.ViewTransitionContext = ViewTransitionContext; exports.FetchersContext = FetchersContext; exports.AwaitContextProvider = AwaitContextProvider; exports.NavigationContext = NavigationContext; exports.LocationContext = LocationContext; exports.RouteContext = RouteContext; exports.ENABLE_DEV_WARNINGS = ENABLE_DEV_WARNINGS; exports.warnOnce = warnOnce; exports.decodeRedirectErrorDigest = decodeRedirectErrorDigest; exports.decodeRouteErrorResponseDigest = decodeRouteErrorResponseDigest; exports.useHref = useHref; exports.useInRouterContext = useInRouterContext; exports.useLocation = useLocation; exports.useNavigationType = useNavigationType; exports.useMatch = useMatch; exports.useNavigate = useNavigate; exports.useOutletContext = useOutletContext; exports.useOutlet = useOutlet; exports.useParams = useParams; exports.useResolvedPath = useResolvedPath; exports.useRoutes = useRoutes; exports.useRoutesImpl = useRoutesImpl; exports.useRouteId = useRouteId; exports.useNavigation = useNavigation; exports.useRevalidator = useRevalidator; exports.useMatches = useMatches; exports.useLoaderData = useLoaderData; exports.useRouteLoaderData = useRouteLoaderData; exports.useActionData = useActionData; exports.useRouteError = useRouteError; exports.useAsyncValue = useAsyncValue; exports.useAsyncError = useAsyncError; exports.useBlocker = useBlocker; exports.useRoute = useRoute; exports.RemixErrorBoundary = RemixErrorBoundary; exports.createServerRoutes = createServerRoutes; exports.createClientRoutesWithHMRRevalidationOptOut = createClientRoutesWithHMRRevalidationOptOut; exports.noActionDefinedError = noActionDefinedError; exports.createClientRoutes = createClientRoutes; exports.shouldHydrateRouteLoader = shouldHydrateRouteLoader; exports.getPatchRoutesOnNavigationFunction = getPatchRoutesOnNavigationFunction; exports.useFogOFWarDiscovery = useFogOFWarDiscovery; exports.getManifestPath = getManifestPath; exports.FrameworkContext = FrameworkContext; exports.usePrefetchBehavior = usePrefetchBehavior; exports.CRITICAL_CSS_DATA_ATTRIBUTE = CRITICAL_CSS_DATA_ATTRIBUTE; exports.Links = Links; exports.PrefetchPageLinks = PrefetchPageLinks; exports.Meta = Meta; exports.setIsHydrated = setIsHydrated; exports.Scripts = Scripts; exports.mergeRefs = mergeRefs; exports.mapRouteProperties = mapRouteProperties; exports.hydrationRouteProperties = hydrationRouteProperties; exports.createMemoryRouter = createMemoryRouter; exports.RouterProvider = RouterProvider; exports.MemoryRouter = MemoryRouter; exports.Navigate = Navigate; exports.Outlet = Outlet; exports.Route = Route; exports.Router = Router; exports.Routes = Routes; exports.Await = Await; exports.createRoutesFromChildren = createRoutesFromChildren; exports.createRoutesFromElements = createRoutesFromElements; exports.renderMatches = renderMatches; exports.WithComponentProps = WithComponentProps; exports.withComponentProps = withComponentProps; exports.WithHydrateFallbackProps = WithHydrateFallbackProps; exports.withHydrateFallbackProps = withHydrateFallbackProps; exports.WithErrorBoundaryProps = WithErrorBoundaryProps; exports.withErrorBoundaryProps = withErrorBoundaryProps;
|