react-router 7.9.6-pre.1 → 7.10.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 +69 -4
- package/dist/development/{browser-C07r42Tt.d.mts → browser-BHySFrZ2.d.mts} +1 -1
- package/dist/development/{browser-BbBXFHbO.d.ts → browser-eL-tAN4R.d.ts} +1 -1
- package/dist/development/{chunk-HSVNPM3C.js → chunk-2VILFZWG.js} +167 -123
- package/dist/development/{chunk-DKSAHU2I.mjs → chunk-4BTFPFZR.mjs} +208 -221
- package/dist/development/{chunk-RGKEVI2W.mjs → chunk-CECIHG5K.mjs} +15 -5
- package/dist/development/{chunk-CYHICRRW.js → chunk-M4WLV5HP.js} +201 -258
- package/dist/development/{chunk-OLIKX45O.js → chunk-Z4R76DXJ.js} +7 -7
- package/dist/development/dom-export.d.mts +21 -2
- package/dist/development/dom-export.d.ts +21 -2
- package/dist/development/dom-export.js +158 -103
- package/dist/development/dom-export.mjs +133 -79
- package/dist/development/{index-react-server-client-Da3kmxNd.d.ts → index-react-server-client-CNrKUHDv.d.ts} +59 -7
- package/dist/{production/index-react-server-client-rcoGPJhU.d.mts → development/index-react-server-client-DYtvZPLT.d.mts} +59 -7
- 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 +19 -4
- package/dist/development/index-react-server.d.ts +19 -4
- package/dist/development/index-react-server.js +30 -24
- package/dist/development/index-react-server.mjs +30 -24
- package/dist/development/index.d.mts +19 -15
- package/dist/development/index.d.ts +19 -15
- package/dist/development/index.js +92 -82
- package/dist/development/index.mjs +3 -3
- package/dist/{production/instrumentation-Unc20tLk.d.ts → development/instrumentation-Dwf-sTWa.d.ts} +66 -8
- 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-BpU9rFBJ.d.ts → register-BnQsYkwj.d.ts} +1 -1
- package/dist/development/{register-QkB3HGjm.d.mts → register-C97Jz2jB.d.mts} +1 -1
- package/dist/development/{router-CAvh_Drx.d.mts → router-Dgz_Mh9m.d.mts} +66 -8
- package/dist/production/{browser-C07r42Tt.d.mts → browser-BHySFrZ2.d.mts} +1 -1
- package/dist/production/{browser-BbBXFHbO.d.ts → browser-eL-tAN4R.d.ts} +1 -1
- package/dist/production/{chunk-2DNJUQK6.js → chunk-55FFLVQP.js} +201 -258
- package/dist/production/{chunk-EDK3MRM6.js → chunk-5DTJHKF7.js} +167 -123
- package/dist/production/{chunk-LESYMMDQ.mjs → chunk-KJ5676BZ.mjs} +208 -221
- package/dist/production/{chunk-LC2OWLJG.mjs → chunk-QKAGOFED.mjs} +15 -5
- package/dist/production/{chunk-JLDESRHY.js → chunk-SGCRBGEM.js} +7 -7
- package/dist/production/dom-export.d.mts +21 -2
- package/dist/production/dom-export.d.ts +21 -2
- package/dist/production/dom-export.js +158 -103
- package/dist/production/dom-export.mjs +133 -79
- package/dist/production/{index-react-server-client-Da3kmxNd.d.ts → index-react-server-client-CNrKUHDv.d.ts} +59 -7
- package/dist/{development/index-react-server-client-rcoGPJhU.d.mts → production/index-react-server-client-DYtvZPLT.d.mts} +59 -7
- 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 +19 -4
- package/dist/production/index-react-server.d.ts +19 -4
- package/dist/production/index-react-server.js +30 -24
- package/dist/production/index-react-server.mjs +30 -24
- package/dist/production/index.d.mts +19 -15
- package/dist/production/index.d.ts +19 -15
- package/dist/production/index.js +92 -82
- package/dist/production/index.mjs +3 -3
- package/dist/{development/instrumentation-Unc20tLk.d.ts → production/instrumentation-Dwf-sTWa.d.ts} +66 -8
- 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-BpU9rFBJ.d.ts → register-BnQsYkwj.d.ts} +1 -1
- package/dist/production/{register-QkB3HGjm.d.mts → register-C97Jz2jB.d.mts} +1 -1
- package/dist/production/{router-CAvh_Drx.d.mts → router-Dgz_Mh9m.d.mts} +66 -8
- package/package.json +1 -1
|
@@ -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.10.0-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -973,8 +973,8 @@ var ErrorResponseImpl = class {
|
|
|
973
973
|
function isRouteErrorResponse(error) {
|
|
974
974
|
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
|
975
975
|
}
|
|
976
|
-
function getRoutePattern(
|
|
977
|
-
return
|
|
976
|
+
function getRoutePattern(matches) {
|
|
977
|
+
return matches.map((m) => m.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
|
|
978
978
|
}
|
|
979
979
|
|
|
980
980
|
// lib/router/instrumentation.ts
|
|
@@ -1411,6 +1411,7 @@ function createRouter(init) {
|
|
|
1411
1411
|
blockers: /* @__PURE__ */ new Map()
|
|
1412
1412
|
};
|
|
1413
1413
|
let pendingAction = "POP" /* Pop */;
|
|
1414
|
+
let pendingPopstateNavigationDfd = null;
|
|
1414
1415
|
let pendingPreventScrollReset = false;
|
|
1415
1416
|
let pendingNavigationController;
|
|
1416
1417
|
let pendingViewTransitionEnabled = false;
|
|
@@ -1470,6 +1471,8 @@ function createRouter(init) {
|
|
|
1470
1471
|
updateState({ blockers });
|
|
1471
1472
|
}
|
|
1472
1473
|
});
|
|
1474
|
+
_optionalChain([pendingPopstateNavigationDfd, 'optionalAccess', _5 => _5.resolve, 'call', _6 => _6()]);
|
|
1475
|
+
pendingPopstateNavigationDfd = null;
|
|
1473
1476
|
return;
|
|
1474
1477
|
}
|
|
1475
1478
|
return startNavigation(historyAction, location);
|
|
@@ -1541,6 +1544,7 @@ function createRouter(init) {
|
|
|
1541
1544
|
[...subscribers].forEach(
|
|
1542
1545
|
(subscriber) => subscriber(state, {
|
|
1543
1546
|
deletedFetchers: unmountedFetchers,
|
|
1547
|
+
newErrors: _nullishCoalesce(newState.errors, () => ( null)),
|
|
1544
1548
|
viewTransitionOpts: opts.viewTransitionOpts,
|
|
1545
1549
|
flushSync: opts.flushSync === true
|
|
1546
1550
|
})
|
|
@@ -1549,7 +1553,7 @@ function createRouter(init) {
|
|
|
1549
1553
|
mountedFetchers.forEach((key) => state.fetchers.delete(key));
|
|
1550
1554
|
}
|
|
1551
1555
|
function completeNavigation(location, newState, { flushSync } = {}) {
|
|
1552
|
-
let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === "loading" && _optionalChain([location, 'access',
|
|
1556
|
+
let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === "loading" && _optionalChain([location, 'access', _7 => _7.state, 'optionalAccess', _8 => _8._isRedirect]) !== true;
|
|
1553
1557
|
let actionData;
|
|
1554
1558
|
if (newState.actionData) {
|
|
1555
1559
|
if (Object.keys(newState.actionData).length > 0) {
|
|
@@ -1574,7 +1578,7 @@ function createRouter(init) {
|
|
|
1574
1578
|
blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER));
|
|
1575
1579
|
}
|
|
1576
1580
|
let restoreScrollPosition = isUninterruptedRevalidation ? false : getSavedScrollPosition(location, newState.matches || state.matches);
|
|
1577
|
-
let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && _optionalChain([location, 'access',
|
|
1581
|
+
let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && _optionalChain([location, 'access', _9 => _9.state, 'optionalAccess', _10 => _10._isRedirect]) !== true;
|
|
1578
1582
|
if (inFlightDataRoutes) {
|
|
1579
1583
|
dataRoutes = inFlightDataRoutes;
|
|
1580
1584
|
inFlightDataRoutes = void 0;
|
|
@@ -1638,21 +1642,29 @@ function createRouter(init) {
|
|
|
1638
1642
|
pendingViewTransitionEnabled = false;
|
|
1639
1643
|
isUninterruptedRevalidation = false;
|
|
1640
1644
|
isRevalidationRequired = false;
|
|
1641
|
-
_optionalChain([
|
|
1645
|
+
_optionalChain([pendingPopstateNavigationDfd, 'optionalAccess', _11 => _11.resolve, 'call', _12 => _12()]);
|
|
1646
|
+
pendingPopstateNavigationDfd = null;
|
|
1647
|
+
_optionalChain([pendingRevalidationDfd, 'optionalAccess', _13 => _13.resolve, 'call', _14 => _14()]);
|
|
1642
1648
|
pendingRevalidationDfd = null;
|
|
1643
1649
|
}
|
|
1644
1650
|
async function navigate(to, opts) {
|
|
1651
|
+
_optionalChain([pendingPopstateNavigationDfd, 'optionalAccess', _15 => _15.resolve, 'call', _16 => _16()]);
|
|
1652
|
+
pendingPopstateNavigationDfd = null;
|
|
1645
1653
|
if (typeof to === "number") {
|
|
1654
|
+
if (!pendingPopstateNavigationDfd) {
|
|
1655
|
+
pendingPopstateNavigationDfd = createDeferred();
|
|
1656
|
+
}
|
|
1657
|
+
let promise = pendingPopstateNavigationDfd.promise;
|
|
1646
1658
|
init.history.go(to);
|
|
1647
|
-
return;
|
|
1659
|
+
return promise;
|
|
1648
1660
|
}
|
|
1649
1661
|
let normalizedPath = normalizeTo(
|
|
1650
1662
|
state.location,
|
|
1651
1663
|
state.matches,
|
|
1652
1664
|
basename,
|
|
1653
1665
|
to,
|
|
1654
|
-
_optionalChain([opts, 'optionalAccess',
|
|
1655
|
-
_optionalChain([opts, 'optionalAccess',
|
|
1666
|
+
_optionalChain([opts, 'optionalAccess', _17 => _17.fromRouteId]),
|
|
1667
|
+
_optionalChain([opts, 'optionalAccess', _18 => _18.relative])
|
|
1656
1668
|
);
|
|
1657
1669
|
let { path, submission, error } = normalizeNavigateOptions(
|
|
1658
1670
|
false,
|
|
@@ -1749,7 +1761,7 @@ function createRouter(init) {
|
|
|
1749
1761
|
pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true;
|
|
1750
1762
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
1751
1763
|
let loadingNavigation = opts && opts.overrideNavigation;
|
|
1752
|
-
let matches = _optionalChain([opts, 'optionalAccess',
|
|
1764
|
+
let matches = _optionalChain([opts, 'optionalAccess', _19 => _19.initialHydration]) && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ? (
|
|
1753
1765
|
// `matchRoutes()` has already been called if we're in here via `router.initialize()`
|
|
1754
1766
|
state.matches
|
|
1755
1767
|
) : matchRoutes(routesToUse, location, basename);
|
|
@@ -2207,7 +2219,7 @@ function createRouter(init) {
|
|
|
2207
2219
|
basename,
|
|
2208
2220
|
href,
|
|
2209
2221
|
routeId,
|
|
2210
|
-
_optionalChain([opts, 'optionalAccess',
|
|
2222
|
+
_optionalChain([opts, 'optionalAccess', _20 => _20.relative])
|
|
2211
2223
|
);
|
|
2212
2224
|
let matches = matchRoutes(routesToUse, normalizedPath, basename);
|
|
2213
2225
|
let fogOfWar = checkFogOfWar(matches, routesToUse, normalizedPath);
|
|
@@ -2584,6 +2596,10 @@ function createRouter(init) {
|
|
|
2584
2596
|
preventScrollReset,
|
|
2585
2597
|
replace: replace2
|
|
2586
2598
|
} = {}) {
|
|
2599
|
+
if (!isNavigation) {
|
|
2600
|
+
_optionalChain([pendingPopstateNavigationDfd, 'optionalAccess', _21 => _21.resolve, 'call', _22 => _22()]);
|
|
2601
|
+
pendingPopstateNavigationDfd = null;
|
|
2602
|
+
}
|
|
2587
2603
|
if (redirect2.response.headers.has("X-Remix-Revalidate")) {
|
|
2588
2604
|
isRevalidationRequired = true;
|
|
2589
2605
|
}
|
|
@@ -2768,7 +2784,7 @@ function createRouter(init) {
|
|
|
2768
2784
|
return state.fetchers.get(key) || IDLE_FETCHER;
|
|
2769
2785
|
}
|
|
2770
2786
|
function resetFetcher(key, opts) {
|
|
2771
|
-
abortFetcher(key, _optionalChain([opts, 'optionalAccess',
|
|
2787
|
+
abortFetcher(key, _optionalChain([opts, 'optionalAccess', _23 => _23.reason]));
|
|
2772
2788
|
updateFetcherState(key, getDoneFetcher(null));
|
|
2773
2789
|
}
|
|
2774
2790
|
function deleteFetcher(key) {
|
|
@@ -3109,9 +3125,9 @@ function createStaticHandler(routes, opts) {
|
|
|
3109
3125
|
);
|
|
3110
3126
|
let manifest = {};
|
|
3111
3127
|
let basename = (opts ? opts.basename : null) || "/";
|
|
3112
|
-
let _mapRouteProperties = _optionalChain([opts, 'optionalAccess',
|
|
3128
|
+
let _mapRouteProperties = _optionalChain([opts, 'optionalAccess', _24 => _24.mapRouteProperties]) || defaultMapRouteProperties;
|
|
3113
3129
|
let mapRouteProperties2 = _mapRouteProperties;
|
|
3114
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
3130
|
+
if (_optionalChain([opts, 'optionalAccess', _25 => _25.unstable_instrumentations])) {
|
|
3115
3131
|
let instrumentations = opts.unstable_instrumentations;
|
|
3116
3132
|
mapRouteProperties2 = (route) => {
|
|
3117
3133
|
return {
|
|
@@ -3192,7 +3208,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3192
3208
|
let response = await runServerMiddlewarePipeline(
|
|
3193
3209
|
{
|
|
3194
3210
|
request,
|
|
3195
|
-
unstable_pattern: getRoutePattern(matches
|
|
3211
|
+
unstable_pattern: getRoutePattern(matches),
|
|
3196
3212
|
matches,
|
|
3197
3213
|
params: matches[0].params,
|
|
3198
3214
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -3256,9 +3272,9 @@ function createStaticHandler(routes, opts) {
|
|
|
3256
3272
|
} else {
|
|
3257
3273
|
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
3258
3274
|
matches,
|
|
3259
|
-
_optionalChain([matches, 'access',
|
|
3275
|
+
_optionalChain([matches, 'access', _26 => _26.find, 'call', _27 => _27(
|
|
3260
3276
|
(m) => m.route.id === routeId || m.route.loader
|
|
3261
|
-
), 'optionalAccess',
|
|
3277
|
+
), 'optionalAccess', _28 => _28.route, 'access', _29 => _29.id]) || routeId
|
|
3262
3278
|
).route.id;
|
|
3263
3279
|
let staticContext = {
|
|
3264
3280
|
matches,
|
|
@@ -3338,7 +3354,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3338
3354
|
let response = await runServerMiddlewarePipeline(
|
|
3339
3355
|
{
|
|
3340
3356
|
request,
|
|
3341
|
-
unstable_pattern: getRoutePattern(matches
|
|
3357
|
+
unstable_pattern: getRoutePattern(matches),
|
|
3342
3358
|
matches,
|
|
3343
3359
|
params: matches[0].params,
|
|
3344
3360
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -3591,11 +3607,11 @@ function createStaticHandler(routes, opts) {
|
|
|
3591
3607
|
}
|
|
3592
3608
|
async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, pendingActionResult) {
|
|
3593
3609
|
let isRouteRequest = routeMatch != null;
|
|
3594
|
-
if (isRouteRequest && !_optionalChain([routeMatch, 'optionalAccess',
|
|
3610
|
+
if (isRouteRequest && !_optionalChain([routeMatch, 'optionalAccess', _30 => _30.route, 'access', _31 => _31.loader]) && !_optionalChain([routeMatch, 'optionalAccess', _32 => _32.route, 'access', _33 => _33.lazy])) {
|
|
3595
3611
|
throw getInternalRouterError(400, {
|
|
3596
3612
|
method: request.method,
|
|
3597
3613
|
pathname: new URL(request.url).pathname,
|
|
3598
|
-
routeId: _optionalChain([routeMatch, 'optionalAccess',
|
|
3614
|
+
routeId: _optionalChain([routeMatch, 'optionalAccess', _34 => _34.route, 'access', _35 => _35.id])
|
|
3599
3615
|
});
|
|
3600
3616
|
}
|
|
3601
3617
|
let dsMatches;
|
|
@@ -3614,7 +3630,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3614
3630
|
// Up to but not including the boundary
|
|
3615
3631
|
matches.findIndex((m) => m.route.id === pendingActionResult[0]) - 1
|
|
3616
3632
|
) : void 0;
|
|
3617
|
-
let pattern = getRoutePattern(matches
|
|
3633
|
+
let pattern = getRoutePattern(matches);
|
|
3618
3634
|
dsMatches = matches.map((match, index) => {
|
|
3619
3635
|
if (maxIdx != null && index > maxIdx) {
|
|
3620
3636
|
return getDataStrategyMatch(
|
|
@@ -3906,14 +3922,14 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
|
|
|
3906
3922
|
let shouldSkipRevalidation = actionStatus && actionStatus >= 400;
|
|
3907
3923
|
let baseShouldRevalidateArgs = {
|
|
3908
3924
|
currentUrl,
|
|
3909
|
-
currentParams: _optionalChain([state, 'access',
|
|
3925
|
+
currentParams: _optionalChain([state, 'access', _36 => _36.matches, 'access', _37 => _37[0], 'optionalAccess', _38 => _38.params]) || {},
|
|
3910
3926
|
nextUrl,
|
|
3911
3927
|
nextParams: matches[0].params,
|
|
3912
3928
|
...submission,
|
|
3913
3929
|
actionResult,
|
|
3914
3930
|
actionStatus
|
|
3915
3931
|
};
|
|
3916
|
-
let pattern = getRoutePattern(matches
|
|
3932
|
+
let pattern = getRoutePattern(matches);
|
|
3917
3933
|
let dsMatches = matches.map((match, index) => {
|
|
3918
3934
|
let { route } = match;
|
|
3919
3935
|
let forceShouldLoad = null;
|
|
@@ -4133,7 +4149,7 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
|
|
|
4133
4149
|
let newRoutes = convertRoutesToDataRoutes(
|
|
4134
4150
|
uniqueChildren,
|
|
4135
4151
|
mapRouteProperties2,
|
|
4136
|
-
[routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess',
|
|
4152
|
+
[routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess', _39 => _39.length]) || "0")],
|
|
4137
4153
|
manifest
|
|
4138
4154
|
);
|
|
4139
4155
|
childrenToPatch.push(...newRoutes);
|
|
@@ -4170,7 +4186,7 @@ function isSameRoute(newRoute, existingRoute) {
|
|
|
4170
4186
|
return true;
|
|
4171
4187
|
}
|
|
4172
4188
|
return newRoute.children.every(
|
|
4173
|
-
(aChild, i) => _optionalChain([existingRoute, 'access',
|
|
4189
|
+
(aChild, i) => _optionalChain([existingRoute, 'access', _40 => _40.children, 'optionalAccess', _41 => _41.some, 'call', _42 => _42((bChild) => isSameRoute(aChild, bChild))])
|
|
4174
4190
|
);
|
|
4175
4191
|
}
|
|
4176
4192
|
var lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -4318,9 +4334,9 @@ function loadLazyRoute(route, type, manifest, mapRouteProperties2, lazyRouteProp
|
|
|
4318
4334
|
}
|
|
4319
4335
|
let lazyRoutePromise = lazyPropertyPromises.length > 0 ? Promise.all(lazyPropertyPromises).then(() => {
|
|
4320
4336
|
}) : void 0;
|
|
4321
|
-
_optionalChain([lazyRoutePromise, 'optionalAccess',
|
|
4337
|
+
_optionalChain([lazyRoutePromise, 'optionalAccess', _43 => _43.catch, 'call', _44 => _44(() => {
|
|
4322
4338
|
})]);
|
|
4323
|
-
_optionalChain([lazyHandlerPromise, 'optionalAccess',
|
|
4339
|
+
_optionalChain([lazyHandlerPromise, 'optionalAccess', _45 => _45.catch, 'call', _46 => _46(() => {
|
|
4324
4340
|
})]);
|
|
4325
4341
|
return {
|
|
4326
4342
|
lazyRoutePromise,
|
|
@@ -4397,7 +4413,7 @@ function runClientMiddlewarePipeline(args, handler) {
|
|
|
4397
4413
|
),
|
|
4398
4414
|
// or the shallowest route that needs to load data
|
|
4399
4415
|
Math.max(
|
|
4400
|
-
matches.findIndex((m) => m.
|
|
4416
|
+
matches.findIndex((m) => m.shouldCallHandler()),
|
|
4401
4417
|
0
|
|
4402
4418
|
)
|
|
4403
4419
|
);
|
|
@@ -4500,7 +4516,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties2, manifest, request
|
|
|
4500
4516
|
handler: lazyRoutePromises.lazyHandlerPromise
|
|
4501
4517
|
};
|
|
4502
4518
|
}
|
|
4503
|
-
function getDataStrategyMatch(mapRouteProperties2, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad,
|
|
4519
|
+
function getDataStrategyMatch(mapRouteProperties2, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null) {
|
|
4504
4520
|
let isUsingNewApi = false;
|
|
4505
4521
|
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
|
4506
4522
|
mapRouteProperties2,
|
|
@@ -4513,19 +4529,19 @@ function getDataStrategyMatch(mapRouteProperties2, manifest, request, unstable_p
|
|
|
4513
4529
|
...match,
|
|
4514
4530
|
_lazyPromises,
|
|
4515
4531
|
shouldLoad,
|
|
4516
|
-
|
|
4517
|
-
|
|
4532
|
+
shouldRevalidateArgs,
|
|
4533
|
+
shouldCallHandler(defaultShouldRevalidate) {
|
|
4518
4534
|
isUsingNewApi = true;
|
|
4519
|
-
if (!
|
|
4535
|
+
if (!shouldRevalidateArgs) {
|
|
4520
4536
|
return shouldLoad;
|
|
4521
4537
|
}
|
|
4522
4538
|
if (typeof defaultShouldRevalidate === "boolean") {
|
|
4523
4539
|
return shouldRevalidateLoader(match, {
|
|
4524
|
-
...
|
|
4540
|
+
...shouldRevalidateArgs,
|
|
4525
4541
|
defaultShouldRevalidate
|
|
4526
4542
|
});
|
|
4527
4543
|
}
|
|
4528
|
-
return shouldRevalidateLoader(match,
|
|
4544
|
+
return shouldRevalidateLoader(match, shouldRevalidateArgs);
|
|
4529
4545
|
},
|
|
4530
4546
|
resolve(handlerOverride) {
|
|
4531
4547
|
let { lazy, loader, middleware } = match.route;
|
|
@@ -4536,8 +4552,8 @@ function getDataStrategyMatch(mapRouteProperties2, manifest, request, unstable_p
|
|
|
4536
4552
|
request,
|
|
4537
4553
|
unstable_pattern,
|
|
4538
4554
|
match,
|
|
4539
|
-
lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess',
|
|
4540
|
-
lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess',
|
|
4555
|
+
lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess', _47 => _47.handler]),
|
|
4556
|
+
lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess', _48 => _48.route]),
|
|
4541
4557
|
handlerOverride,
|
|
4542
4558
|
scopedContext
|
|
4543
4559
|
});
|
|
@@ -4552,8 +4568,8 @@ function getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request,
|
|
|
4552
4568
|
return {
|
|
4553
4569
|
...match,
|
|
4554
4570
|
shouldLoad: false,
|
|
4555
|
-
|
|
4556
|
-
|
|
4571
|
+
shouldRevalidateArgs,
|
|
4572
|
+
shouldCallHandler: () => false,
|
|
4557
4573
|
_lazyPromises: getDataStrategyMatchLazyPromises(
|
|
4558
4574
|
mapRouteProperties2,
|
|
4559
4575
|
manifest,
|
|
@@ -4568,7 +4584,7 @@ function getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request,
|
|
|
4568
4584
|
mapRouteProperties2,
|
|
4569
4585
|
manifest,
|
|
4570
4586
|
request,
|
|
4571
|
-
getRoutePattern(matches
|
|
4587
|
+
getRoutePattern(matches),
|
|
4572
4588
|
match,
|
|
4573
4589
|
lazyRoutePropertiesToSkip,
|
|
4574
4590
|
scopedContext,
|
|
@@ -4578,12 +4594,12 @@ function getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request,
|
|
|
4578
4594
|
});
|
|
4579
4595
|
}
|
|
4580
4596
|
async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherKey, scopedContext, isStaticHandler) {
|
|
4581
|
-
if (matches.some((m) => _optionalChain([m, 'access',
|
|
4582
|
-
await Promise.all(matches.map((m) => _optionalChain([m, 'access',
|
|
4597
|
+
if (matches.some((m) => _optionalChain([m, 'access', _49 => _49._lazyPromises, 'optionalAccess', _50 => _50.middleware]))) {
|
|
4598
|
+
await Promise.all(matches.map((m) => _optionalChain([m, 'access', _51 => _51._lazyPromises, 'optionalAccess', _52 => _52.middleware])));
|
|
4583
4599
|
}
|
|
4584
4600
|
let dataStrategyArgs = {
|
|
4585
4601
|
request,
|
|
4586
|
-
unstable_pattern: getRoutePattern(matches
|
|
4602
|
+
unstable_pattern: getRoutePattern(matches),
|
|
4587
4603
|
params: matches[0].params,
|
|
4588
4604
|
context: scopedContext,
|
|
4589
4605
|
matches
|
|
@@ -4614,8 +4630,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4614
4630
|
try {
|
|
4615
4631
|
await Promise.all(
|
|
4616
4632
|
matches.flatMap((m) => [
|
|
4617
|
-
_optionalChain([m, 'access',
|
|
4618
|
-
_optionalChain([m, 'access',
|
|
4633
|
+
_optionalChain([m, 'access', _53 => _53._lazyPromises, 'optionalAccess', _54 => _54.handler]),
|
|
4634
|
+
_optionalChain([m, 'access', _55 => _55._lazyPromises, 'optionalAccess', _56 => _56.route])
|
|
4619
4635
|
])
|
|
4620
4636
|
);
|
|
4621
4637
|
} catch (e) {
|
|
@@ -4760,19 +4776,15 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4760
4776
|
return {
|
|
4761
4777
|
type: "error" /* error */,
|
|
4762
4778
|
error: result.data,
|
|
4763
|
-
statusCode: _optionalChain([result, 'access',
|
|
4764
|
-
headers: _optionalChain([result, 'access',
|
|
4779
|
+
statusCode: _optionalChain([result, 'access', _57 => _57.init, 'optionalAccess', _58 => _58.status]),
|
|
4780
|
+
headers: _optionalChain([result, 'access', _59 => _59.init, 'optionalAccess', _60 => _60.headers]) ? new Headers(result.init.headers) : void 0
|
|
4765
4781
|
};
|
|
4766
4782
|
}
|
|
4767
4783
|
return {
|
|
4768
4784
|
type: "error" /* error */,
|
|
4769
|
-
error:
|
|
4770
|
-
_optionalChain([result, 'access', _53 => _53.init, 'optionalAccess', _54 => _54.status]) || 500,
|
|
4771
|
-
void 0,
|
|
4772
|
-
result.data
|
|
4773
|
-
),
|
|
4785
|
+
error: dataWithResponseInitToErrorResponse(result),
|
|
4774
4786
|
statusCode: isRouteErrorResponse(result) ? result.status : void 0,
|
|
4775
|
-
headers: _optionalChain([result, 'access',
|
|
4787
|
+
headers: _optionalChain([result, 'access', _61 => _61.init, 'optionalAccess', _62 => _62.headers]) ? new Headers(result.init.headers) : void 0
|
|
4776
4788
|
};
|
|
4777
4789
|
}
|
|
4778
4790
|
return {
|
|
@@ -4785,8 +4797,8 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4785
4797
|
return {
|
|
4786
4798
|
type: "data" /* data */,
|
|
4787
4799
|
data: result.data,
|
|
4788
|
-
statusCode: _optionalChain([result, 'access',
|
|
4789
|
-
headers: _optionalChain([result, 'access',
|
|
4800
|
+
statusCode: _optionalChain([result, 'access', _63 => _63.init, 'optionalAccess', _64 => _64.status]),
|
|
4801
|
+
headers: _optionalChain([result, 'access', _65 => _65.init, 'optionalAccess', _66 => _66.headers]) ? new Headers(result.init.headers) : void 0
|
|
4790
4802
|
};
|
|
4791
4803
|
}
|
|
4792
4804
|
return { type: "data" /* data */, data: result };
|
|
@@ -4935,7 +4947,7 @@ function processLoaderData(state, matches, results, pendingActionResult, revalid
|
|
|
4935
4947
|
let result = fetcherResults[key];
|
|
4936
4948
|
invariant(result, "Did not find corresponding fetcher result");
|
|
4937
4949
|
if (isErrorResult(result)) {
|
|
4938
|
-
let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess',
|
|
4950
|
+
let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess', _67 => _67.route, 'access', _68 => _68.id]));
|
|
4939
4951
|
if (!(errors && errors[boundaryMatch.route.id])) {
|
|
4940
4952
|
errors = {
|
|
4941
4953
|
...errors,
|
|
@@ -5069,8 +5081,8 @@ function dataWithResponseInitToResponse(data2) {
|
|
|
5069
5081
|
}
|
|
5070
5082
|
function dataWithResponseInitToErrorResponse(data2) {
|
|
5071
5083
|
return new ErrorResponseImpl(
|
|
5072
|
-
_nullishCoalesce(_optionalChain([data2, 'access',
|
|
5073
|
-
_nullishCoalesce(_optionalChain([data2, 'access',
|
|
5084
|
+
_nullishCoalesce(_optionalChain([data2, 'access', _69 => _69.init, 'optionalAccess', _70 => _70.status]), () => ( 500)),
|
|
5085
|
+
_nullishCoalesce(_optionalChain([data2, 'access', _71 => _71.init, 'optionalAccess', _72 => _72.statusText]), () => ( "Internal Server Error")),
|
|
5074
5086
|
data2.data
|
|
5075
5087
|
);
|
|
5076
5088
|
}
|
|
@@ -6102,7 +6114,7 @@ function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules
|
|
|
6102
6114
|
return {
|
|
6103
6115
|
hasLoader: manifestRoute.hasLoader,
|
|
6104
6116
|
hasClientLoader: manifestRoute.hasClientLoader,
|
|
6105
|
-
hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess',
|
|
6117
|
+
hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess', _73 => _73.shouldRevalidate]))
|
|
6106
6118
|
};
|
|
6107
6119
|
},
|
|
6108
6120
|
fetchAndDecodeViaTurboStream,
|
|
@@ -6120,7 +6132,7 @@ function getSingleFetchDataStrategyImpl(getRouter, getRouteInfo, fetchAndDecode,
|
|
|
6120
6132
|
}
|
|
6121
6133
|
let foundRevalidatingServerLoader = matches.some((m) => {
|
|
6122
6134
|
let { hasLoader, hasClientLoader } = getRouteInfo(m);
|
|
6123
|
-
return m.
|
|
6135
|
+
return m.shouldCallHandler() && hasLoader && !hasClientLoader;
|
|
6124
6136
|
});
|
|
6125
6137
|
if (!ssr && !foundRevalidatingServerLoader) {
|
|
6126
6138
|
return nonSsrStrategy(args, getRouteInfo, fetchAndDecode, basename);
|
|
@@ -6140,7 +6152,7 @@ function getSingleFetchDataStrategyImpl(getRouter, getRouteInfo, fetchAndDecode,
|
|
|
6140
6152
|
};
|
|
6141
6153
|
}
|
|
6142
6154
|
async function singleFetchActionStrategy(args, fetchAndDecode, basename) {
|
|
6143
|
-
let actionMatch = args.matches.find((m) => m.
|
|
6155
|
+
let actionMatch = args.matches.find((m) => m.shouldCallHandler());
|
|
6144
6156
|
invariant2(actionMatch, "No action match found");
|
|
6145
6157
|
let actionStatus = void 0;
|
|
6146
6158
|
let result = await actionMatch.resolve(async (handler) => {
|
|
@@ -6164,9 +6176,7 @@ async function singleFetchActionStrategy(args, fetchAndDecode, basename) {
|
|
|
6164
6176
|
};
|
|
6165
6177
|
}
|
|
6166
6178
|
async function nonSsrStrategy(args, getRouteInfo, fetchAndDecode, basename) {
|
|
6167
|
-
let matchesToLoad = args.matches.filter(
|
|
6168
|
-
(m) => m.unstable_shouldCallHandler()
|
|
6169
|
-
);
|
|
6179
|
+
let matchesToLoad = args.matches.filter((m) => m.shouldCallHandler());
|
|
6170
6180
|
let results = {};
|
|
6171
6181
|
await Promise.all(
|
|
6172
6182
|
matchesToLoad.map(
|
|
@@ -6199,10 +6209,10 @@ async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, f
|
|
|
6199
6209
|
routeDfds[i].resolve();
|
|
6200
6210
|
let routeId = m.route.id;
|
|
6201
6211
|
let { hasLoader, hasClientLoader, hasShouldRevalidate } = getRouteInfo(m);
|
|
6202
|
-
let defaultShouldRevalidate = !m.
|
|
6203
|
-
let shouldCall = m.
|
|
6212
|
+
let defaultShouldRevalidate = !m.shouldRevalidateArgs || m.shouldRevalidateArgs.actionStatus == null || m.shouldRevalidateArgs.actionStatus < 400;
|
|
6213
|
+
let shouldCall = m.shouldCallHandler(defaultShouldRevalidate);
|
|
6204
6214
|
if (!shouldCall) {
|
|
6205
|
-
foundOptOutRoute || (foundOptOutRoute = m.
|
|
6215
|
+
foundOptOutRoute || (foundOptOutRoute = m.shouldRevalidateArgs != null && // This is a revalidation,
|
|
6206
6216
|
hasLoader && // for a route with a server loader,
|
|
6207
6217
|
hasShouldRevalidate === true);
|
|
6208
6218
|
return;
|
|
@@ -6269,7 +6279,7 @@ async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams,
|
|
|
6269
6279
|
let routeResult = fetchedData.routes[match.route.id];
|
|
6270
6280
|
if ("error" in routeResult) {
|
|
6271
6281
|
middlewareError = routeResult.error;
|
|
6272
|
-
if (_optionalChain([results, 'access',
|
|
6282
|
+
if (_optionalChain([results, 'access', _74 => _74[match.route.id], 'optionalAccess', _75 => _75.result]) == null) {
|
|
6273
6283
|
results[match.route.id] = {
|
|
6274
6284
|
type: "error",
|
|
6275
6285
|
result: middlewareError
|
|
@@ -6291,7 +6301,7 @@ async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams,
|
|
|
6291
6301
|
}
|
|
6292
6302
|
}
|
|
6293
6303
|
async function singleFetchLoaderFetcherStrategy(args, fetchAndDecode, basename) {
|
|
6294
|
-
let fetcherMatch = args.matches.find((m) => m.
|
|
6304
|
+
let fetcherMatch = args.matches.find((m) => m.shouldCallHandler());
|
|
6295
6305
|
invariant2(fetcherMatch, "No fetcher match found");
|
|
6296
6306
|
let routeId = fetcherMatch.route.id;
|
|
6297
6307
|
let result = await fetcherMatch.resolve(
|
|
@@ -6382,7 +6392,7 @@ async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
|
|
|
6382
6392
|
}
|
|
6383
6393
|
} else {
|
|
6384
6394
|
let typed = decoded.value;
|
|
6385
|
-
let routeId = _optionalChain([targetRoutes, 'optionalAccess',
|
|
6395
|
+
let routeId = _optionalChain([targetRoutes, 'optionalAccess', _76 => _76[0]]);
|
|
6386
6396
|
invariant2(routeId, "No routeId found for single fetch call decoding");
|
|
6387
6397
|
if ("redirect" in typed) {
|
|
6388
6398
|
data2 = { redirect: typed };
|
|
@@ -6694,7 +6704,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
6694
6704
|
if (locationArg) {
|
|
6695
6705
|
let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
6696
6706
|
invariant(
|
|
6697
|
-
parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access',
|
|
6707
|
+
parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _77 => _77.pathname, 'optionalAccess', _78 => _78.startsWith, 'call', _79 => _79(parentPathnameBase)]),
|
|
6698
6708
|
`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.`
|
|
6699
6709
|
);
|
|
6700
6710
|
location = parsedLocationArg;
|
|
@@ -6856,10 +6866,10 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
|
|
|
6856
6866
|
}
|
|
6857
6867
|
}
|
|
6858
6868
|
let renderedMatches = matches;
|
|
6859
|
-
let errors = _optionalChain([dataRouterState, 'optionalAccess',
|
|
6869
|
+
let errors = _optionalChain([dataRouterState, 'optionalAccess', _80 => _80.errors]);
|
|
6860
6870
|
if (errors != null) {
|
|
6861
6871
|
let errorIndex = renderedMatches.findIndex(
|
|
6862
|
-
(m) => m.route.id && _optionalChain([errors, 'optionalAccess',
|
|
6872
|
+
(m) => m.route.id && _optionalChain([errors, 'optionalAccess', _81 => _81[m.route.id]]) !== void 0
|
|
6863
6873
|
);
|
|
6864
6874
|
invariant(
|
|
6865
6875
|
errorIndex >= 0,
|
|
@@ -6898,7 +6908,8 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
|
|
|
6898
6908
|
let onError = dataRouterState && unstable_onError ? (error, errorInfo) => {
|
|
6899
6909
|
unstable_onError(error, {
|
|
6900
6910
|
location: dataRouterState.location,
|
|
6901
|
-
params: _nullishCoalesce(_optionalChain([dataRouterState, 'access',
|
|
6911
|
+
params: _nullishCoalesce(_optionalChain([dataRouterState, 'access', _82 => _82.matches, 'optionalAccess', _83 => _83[0], 'optionalAccess', _84 => _84.params]), () => ( {})),
|
|
6912
|
+
unstable_pattern: getRoutePattern(dataRouterState.matches),
|
|
6902
6913
|
errorInfo
|
|
6903
6914
|
});
|
|
6904
6915
|
} : void 0;
|
|
@@ -7044,15 +7055,15 @@ function useRouteError() {
|
|
|
7044
7055
|
if (error !== void 0) {
|
|
7045
7056
|
return error;
|
|
7046
7057
|
}
|
|
7047
|
-
return _optionalChain([state, 'access',
|
|
7058
|
+
return _optionalChain([state, 'access', _85 => _85.errors, 'optionalAccess', _86 => _86[routeId]]);
|
|
7048
7059
|
}
|
|
7049
7060
|
function useAsyncValue() {
|
|
7050
7061
|
let value = React3.useContext(AwaitContext);
|
|
7051
|
-
return _optionalChain([value, 'optionalAccess',
|
|
7062
|
+
return _optionalChain([value, 'optionalAccess', _87 => _87._data]);
|
|
7052
7063
|
}
|
|
7053
7064
|
function useAsyncError() {
|
|
7054
7065
|
let value = React3.useContext(AwaitContext);
|
|
7055
|
-
return _optionalChain([value, 'optionalAccess',
|
|
7066
|
+
return _optionalChain([value, 'optionalAccess', _88 => _88._error]);
|
|
7056
7067
|
}
|
|
7057
7068
|
var blockerId = 0;
|
|
7058
7069
|
function useBlocker(shouldBlock) {
|
|
@@ -7106,7 +7117,7 @@ function useNavigateStable() {
|
|
|
7106
7117
|
warning(activeRef.current, navigateEffectWarning);
|
|
7107
7118
|
if (!activeRef.current) return;
|
|
7108
7119
|
if (typeof to === "number") {
|
|
7109
|
-
router.navigate(to);
|
|
7120
|
+
await router.navigate(to);
|
|
7110
7121
|
} else {
|
|
7111
7122
|
await router.navigate(to, { fromRouteId: id, ...options });
|
|
7112
7123
|
}
|
|
@@ -7133,7 +7144,7 @@ function useRoute(...args) {
|
|
|
7133
7144
|
return {
|
|
7134
7145
|
handle: route.route.handle,
|
|
7135
7146
|
loaderData: state.loaderData[id],
|
|
7136
|
-
actionData: _optionalChain([state, 'access',
|
|
7147
|
+
actionData: _optionalChain([state, 'access', _89 => _89.actionData, 'optionalAccess', _90 => _90[id]])
|
|
7137
7148
|
};
|
|
7138
7149
|
}
|
|
7139
7150
|
|
|
@@ -7178,7 +7189,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
7178
7189
|
let route = manifest.routes[match.route.id];
|
|
7179
7190
|
return [
|
|
7180
7191
|
route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
|
|
7181
|
-
_optionalChain([module, 'optionalAccess',
|
|
7192
|
+
_optionalChain([module, 'optionalAccess', _91 => _91.links, 'optionalCall', _92 => _92()]) || []
|
|
7182
7193
|
];
|
|
7183
7194
|
}).flat(2);
|
|
7184
7195
|
let preloads = getModuleLinkHrefs(matches, manifest);
|
|
@@ -7279,7 +7290,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
7279
7290
|
// param change, /users/123 -> /users/456
|
|
7280
7291
|
currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
|
|
7281
7292
|
// e.g. /files/images/avatar.jpg -> files/finances.xls
|
|
7282
|
-
_optionalChain([currentMatches, 'access',
|
|
7293
|
+
_optionalChain([currentMatches, 'access', _93 => _93[index], 'access', _94 => _94.route, 'access', _95 => _95.path, 'optionalAccess', _96 => _96.endsWith, 'call', _97 => _97("*")]) && currentMatches[index].params["*"] !== match.params["*"]
|
|
7283
7294
|
);
|
|
7284
7295
|
};
|
|
7285
7296
|
if (mode === "assets") {
|
|
@@ -7302,7 +7313,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
7302
7313
|
location.pathname + location.search + location.hash,
|
|
7303
7314
|
window.origin
|
|
7304
7315
|
),
|
|
7305
|
-
currentParams: _optionalChain([currentMatches, 'access',
|
|
7316
|
+
currentParams: _optionalChain([currentMatches, 'access', _98 => _98[0], 'optionalAccess', _99 => _99.params]) || {},
|
|
7306
7317
|
nextUrl: new URL(page, window.origin),
|
|
7307
7318
|
nextParams: match.params,
|
|
7308
7319
|
defaultShouldRevalidate: true
|
|
@@ -7574,10 +7585,10 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7574
7585
|
)
|
|
7575
7586
|
});
|
|
7576
7587
|
let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
|
|
7577
|
-
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess',
|
|
7588
|
+
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _100 => _100.loaderData, 'optionalAccess', _101 => _101[route.id]]) : void 0;
|
|
7578
7589
|
let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
|
|
7579
|
-
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess',
|
|
7580
|
-
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access',
|
|
7590
|
+
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _102 => _102.errors, 'optionalAccess', _103 => _103[route.id]]) : void 0;
|
|
7591
|
+
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _104 => _104.clientLoader, 'optionalAccess', _105 => _105.hydrate]) === true || !route.hasLoader);
|
|
7581
7592
|
dataRoute.loader = async ({ request, params, context, unstable_pattern }, singleFetch) => {
|
|
7582
7593
|
try {
|
|
7583
7594
|
let result = await prefetchStylesAndCallHandler(async () => {
|
|
@@ -7768,10 +7779,6 @@ function getShouldRevalidateFunction(path, route, manifestRoute, ssr, needsReval
|
|
|
7768
7779
|
return (opts) => didParamsChange(opts);
|
|
7769
7780
|
}
|
|
7770
7781
|
}
|
|
7771
|
-
if (ssr && route.shouldRevalidate) {
|
|
7772
|
-
let fn = route.shouldRevalidate;
|
|
7773
|
-
return (opts) => fn({ ...opts, defaultShouldRevalidate: true });
|
|
7774
|
-
}
|
|
7775
7782
|
return route.shouldRevalidate;
|
|
7776
7783
|
}
|
|
7777
7784
|
function wrapShouldRevalidateForHdr(routeId, routeShouldRevalidate, needsRevalidation) {
|
|
@@ -7873,7 +7880,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
|
|
|
7873
7880
|
function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
|
|
7874
7881
|
React6.useEffect(() => {
|
|
7875
7882
|
if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
|
|
7876
|
-
_optionalChain([window, 'access',
|
|
7883
|
+
_optionalChain([window, 'access', _106 => _106.navigator, 'optionalAccess', _107 => _107.connection, 'optionalAccess', _108 => _108.saveData]) === true) {
|
|
7877
7884
|
return;
|
|
7878
7885
|
}
|
|
7879
7886
|
function registerElement(el) {
|
|
@@ -7982,7 +7989,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
|
|
|
7982
7989
|
}
|
|
7983
7990
|
serverPatches = await res.json();
|
|
7984
7991
|
} catch (e) {
|
|
7985
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
7992
|
+
if (_optionalChain([signal, 'optionalAccess', _109 => _109.aborted])) return;
|
|
7986
7993
|
throw e;
|
|
7987
7994
|
}
|
|
7988
7995
|
let knownRoutes = new Set(Object.keys(manifest.routes));
|
|
@@ -8223,7 +8230,7 @@ function PrefetchPageLinksImpl({
|
|
|
8223
8230
|
if (!manifestRoute || !manifestRoute.hasLoader) {
|
|
8224
8231
|
return;
|
|
8225
8232
|
}
|
|
8226
|
-
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access',
|
|
8233
|
+
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _110 => _110[m.route.id], 'optionalAccess', _111 => _111.shouldRevalidate])) {
|
|
8227
8234
|
foundOptOutRoute = true;
|
|
8228
8235
|
} else if (manifestRoute.hasClientLoader) {
|
|
8229
8236
|
foundOptOutRoute = true;
|
|
@@ -8297,7 +8304,7 @@ function Meta() {
|
|
|
8297
8304
|
error
|
|
8298
8305
|
};
|
|
8299
8306
|
matches[i] = match;
|
|
8300
|
-
if (_optionalChain([routeModule, 'optionalAccess',
|
|
8307
|
+
if (_optionalChain([routeModule, 'optionalAccess', _112 => _112.meta])) {
|
|
8301
8308
|
routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
|
|
8302
8309
|
data: data2,
|
|
8303
8310
|
loaderData: data2,
|
|
@@ -8396,7 +8403,7 @@ function Scripts(scriptProps) {
|
|
|
8396
8403
|
}
|
|
8397
8404
|
let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
|
|
8398
8405
|
let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
|
|
8399
|
-
let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access',
|
|
8406
|
+
let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _113 => _113.hmr, 'optionalAccess', _114 => _114.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
|
|
8400
8407
|
${matches.map((match, routeIndex) => {
|
|
8401
8408
|
let routeVarName = `route${routeIndex}`;
|
|
8402
8409
|
let manifestEntry = manifest.routes[match.route.id];
|
|
@@ -8626,7 +8633,7 @@ function BoundaryShell({
|
|
|
8626
8633
|
children
|
|
8627
8634
|
}) {
|
|
8628
8635
|
let { routeModules } = useFrameworkContext();
|
|
8629
|
-
if (_optionalChain([routeModules, 'access',
|
|
8636
|
+
if (_optionalChain([routeModules, 'access', _115 => _115.root, 'optionalAccess', _116 => _116.Layout]) && !isOutsideRemixApp) {
|
|
8630
8637
|
return children;
|
|
8631
8638
|
}
|
|
8632
8639
|
return /* @__PURE__ */ React8.createElement("html", { lang: "en" }, /* @__PURE__ */ React8.createElement("head", null, /* @__PURE__ */ React8.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React8.createElement(
|
|
@@ -8640,6 +8647,15 @@ function BoundaryShell({
|
|
|
8640
8647
|
|
|
8641
8648
|
// lib/components.tsx
|
|
8642
8649
|
|
|
8650
|
+
var USE_OPTIMISTIC = "useOptimistic";
|
|
8651
|
+
var useOptimisticImpl = React9[USE_OPTIMISTIC];
|
|
8652
|
+
function useOptimisticSafe(val) {
|
|
8653
|
+
if (useOptimisticImpl) {
|
|
8654
|
+
return useOptimisticImpl(val);
|
|
8655
|
+
} else {
|
|
8656
|
+
return [val, () => void 0];
|
|
8657
|
+
}
|
|
8658
|
+
}
|
|
8643
8659
|
function mapRouteProperties(route) {
|
|
8644
8660
|
let updates = {
|
|
8645
8661
|
// Note: this check also occurs in createRoutesFromChildren so update
|
|
@@ -8696,20 +8712,20 @@ var hydrationRouteProperties = [
|
|
|
8696
8712
|
];
|
|
8697
8713
|
function createMemoryRouter(routes, opts) {
|
|
8698
8714
|
return createRouter({
|
|
8699
|
-
basename: _optionalChain([opts, 'optionalAccess',
|
|
8700
|
-
getContext: _optionalChain([opts, 'optionalAccess',
|
|
8701
|
-
future: _optionalChain([opts, 'optionalAccess',
|
|
8715
|
+
basename: _optionalChain([opts, 'optionalAccess', _117 => _117.basename]),
|
|
8716
|
+
getContext: _optionalChain([opts, 'optionalAccess', _118 => _118.getContext]),
|
|
8717
|
+
future: _optionalChain([opts, 'optionalAccess', _119 => _119.future]),
|
|
8702
8718
|
history: createMemoryHistory({
|
|
8703
|
-
initialEntries: _optionalChain([opts, 'optionalAccess',
|
|
8704
|
-
initialIndex: _optionalChain([opts, 'optionalAccess',
|
|
8719
|
+
initialEntries: _optionalChain([opts, 'optionalAccess', _120 => _120.initialEntries]),
|
|
8720
|
+
initialIndex: _optionalChain([opts, 'optionalAccess', _121 => _121.initialIndex])
|
|
8705
8721
|
}),
|
|
8706
|
-
hydrationData: _optionalChain([opts, 'optionalAccess',
|
|
8722
|
+
hydrationData: _optionalChain([opts, 'optionalAccess', _122 => _122.hydrationData]),
|
|
8707
8723
|
routes,
|
|
8708
8724
|
hydrationRouteProperties,
|
|
8709
8725
|
mapRouteProperties,
|
|
8710
|
-
dataStrategy: _optionalChain([opts, 'optionalAccess',
|
|
8711
|
-
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess',
|
|
8712
|
-
unstable_instrumentations: _optionalChain([opts, 'optionalAccess',
|
|
8726
|
+
dataStrategy: _optionalChain([opts, 'optionalAccess', _123 => _123.dataStrategy]),
|
|
8727
|
+
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _124 => _124.patchRoutesOnNavigation]),
|
|
8728
|
+
unstable_instrumentations: _optionalChain([opts, 'optionalAccess', _125 => _125.unstable_instrumentations])
|
|
8713
8729
|
}).initialize();
|
|
8714
8730
|
}
|
|
8715
8731
|
var Deferred2 = class {
|
|
@@ -8731,125 +8747,14 @@ var Deferred2 = class {
|
|
|
8731
8747
|
});
|
|
8732
8748
|
}
|
|
8733
8749
|
};
|
|
8734
|
-
function shallowDiff(a, b) {
|
|
8735
|
-
if (a === b) {
|
|
8736
|
-
return false;
|
|
8737
|
-
}
|
|
8738
|
-
let aKeys = Object.keys(a);
|
|
8739
|
-
let bKeys = Object.keys(b);
|
|
8740
|
-
if (aKeys.length !== bKeys.length) {
|
|
8741
|
-
return true;
|
|
8742
|
-
}
|
|
8743
|
-
for (let key of aKeys) {
|
|
8744
|
-
if (a[key] !== b[key]) {
|
|
8745
|
-
return true;
|
|
8746
|
-
}
|
|
8747
|
-
}
|
|
8748
|
-
return false;
|
|
8749
|
-
}
|
|
8750
|
-
function UNSTABLE_TransitionEnabledRouterProvider({
|
|
8751
|
-
router,
|
|
8752
|
-
flushSync: reactDomFlushSyncImpl,
|
|
8753
|
-
unstable_onError
|
|
8754
|
-
}) {
|
|
8755
|
-
let fetcherData = React9.useRef(/* @__PURE__ */ new Map());
|
|
8756
|
-
let [revalidating, startRevalidation] = React9.useTransition();
|
|
8757
|
-
let [state, setState] = React9.useState(router.state);
|
|
8758
|
-
router.__setPendingRerender = (promise) => startRevalidation(
|
|
8759
|
-
// @ts-expect-error - need react 19 types for this to be async
|
|
8760
|
-
async () => {
|
|
8761
|
-
const rerender = await promise;
|
|
8762
|
-
startRevalidation(() => {
|
|
8763
|
-
rerender();
|
|
8764
|
-
});
|
|
8765
|
-
}
|
|
8766
|
-
);
|
|
8767
|
-
let navigator = React9.useMemo(() => {
|
|
8768
|
-
return {
|
|
8769
|
-
createHref: router.createHref,
|
|
8770
|
-
encodeLocation: router.encodeLocation,
|
|
8771
|
-
go: (n) => router.navigate(n),
|
|
8772
|
-
push: (to, state2, opts) => router.navigate(to, {
|
|
8773
|
-
state: state2,
|
|
8774
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess', _120 => _120.preventScrollReset])
|
|
8775
|
-
}),
|
|
8776
|
-
replace: (to, state2, opts) => router.navigate(to, {
|
|
8777
|
-
replace: true,
|
|
8778
|
-
state: state2,
|
|
8779
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess', _121 => _121.preventScrollReset])
|
|
8780
|
-
})
|
|
8781
|
-
};
|
|
8782
|
-
}, [router]);
|
|
8783
|
-
let basename = router.basename || "/";
|
|
8784
|
-
let dataRouterContext = React9.useMemo(
|
|
8785
|
-
() => ({
|
|
8786
|
-
router,
|
|
8787
|
-
navigator,
|
|
8788
|
-
static: false,
|
|
8789
|
-
basename,
|
|
8790
|
-
unstable_onError
|
|
8791
|
-
}),
|
|
8792
|
-
[router, navigator, basename, unstable_onError]
|
|
8793
|
-
);
|
|
8794
|
-
React9.useLayoutEffect(() => {
|
|
8795
|
-
return router.subscribe(
|
|
8796
|
-
(newState, { deletedFetchers, flushSync, viewTransitionOpts }) => {
|
|
8797
|
-
newState.fetchers.forEach((fetcher, key) => {
|
|
8798
|
-
if (fetcher.data !== void 0) {
|
|
8799
|
-
fetcherData.current.set(key, fetcher.data);
|
|
8800
|
-
}
|
|
8801
|
-
});
|
|
8802
|
-
deletedFetchers.forEach((key) => fetcherData.current.delete(key));
|
|
8803
|
-
const diff = shallowDiff(state, newState);
|
|
8804
|
-
if (!diff) return;
|
|
8805
|
-
if (flushSync) {
|
|
8806
|
-
if (reactDomFlushSyncImpl) {
|
|
8807
|
-
reactDomFlushSyncImpl(() => setState(newState));
|
|
8808
|
-
} else {
|
|
8809
|
-
setState(newState);
|
|
8810
|
-
}
|
|
8811
|
-
} else {
|
|
8812
|
-
React9.startTransition(() => {
|
|
8813
|
-
setState(newState);
|
|
8814
|
-
});
|
|
8815
|
-
}
|
|
8816
|
-
}
|
|
8817
|
-
);
|
|
8818
|
-
}, [router, reactDomFlushSyncImpl, state]);
|
|
8819
|
-
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React9.createElement(
|
|
8820
|
-
DataRouterStateContext.Provider,
|
|
8821
|
-
{
|
|
8822
|
-
value: {
|
|
8823
|
-
...state,
|
|
8824
|
-
revalidation: revalidating ? "loading" : state.revalidation
|
|
8825
|
-
}
|
|
8826
|
-
},
|
|
8827
|
-
/* @__PURE__ */ React9.createElement(FetchersContext.Provider, { value: fetcherData.current }, /* @__PURE__ */ React9.createElement(
|
|
8828
|
-
Router,
|
|
8829
|
-
{
|
|
8830
|
-
basename,
|
|
8831
|
-
location: state.location,
|
|
8832
|
-
navigationType: state.historyAction,
|
|
8833
|
-
navigator
|
|
8834
|
-
},
|
|
8835
|
-
/* @__PURE__ */ React9.createElement(
|
|
8836
|
-
MemoizedDataRoutes,
|
|
8837
|
-
{
|
|
8838
|
-
routes: router.routes,
|
|
8839
|
-
future: router.future,
|
|
8840
|
-
state,
|
|
8841
|
-
unstable_onError
|
|
8842
|
-
}
|
|
8843
|
-
)
|
|
8844
|
-
))
|
|
8845
|
-
)), null);
|
|
8846
|
-
}
|
|
8847
8750
|
function RouterProvider({
|
|
8848
8751
|
router,
|
|
8849
8752
|
flushSync: reactDomFlushSyncImpl,
|
|
8850
|
-
unstable_onError
|
|
8753
|
+
unstable_onError,
|
|
8754
|
+
unstable_useTransitions
|
|
8851
8755
|
}) {
|
|
8852
|
-
let [
|
|
8756
|
+
let [_state, setStateImpl] = React9.useState(router.state);
|
|
8757
|
+
let [state, setOptimisticState] = useOptimisticSafe(_state);
|
|
8853
8758
|
let [pendingState, setPendingState] = React9.useState();
|
|
8854
8759
|
let [vtContext, setVtContext] = React9.useState({
|
|
8855
8760
|
isTransitioning: false
|
|
@@ -8858,26 +8763,17 @@ function RouterProvider({
|
|
|
8858
8763
|
let [transition, setTransition] = React9.useState();
|
|
8859
8764
|
let [interruption, setInterruption] = React9.useState();
|
|
8860
8765
|
let fetcherData = React9.useRef(/* @__PURE__ */ new Map());
|
|
8861
|
-
let logErrorsAndSetState = React9.useCallback(
|
|
8862
|
-
(newState) => {
|
|
8863
|
-
setStateImpl((prevState) => {
|
|
8864
|
-
if (newState.errors && unstable_onError) {
|
|
8865
|
-
Object.entries(newState.errors).forEach(([routeId, error]) => {
|
|
8866
|
-
if (_optionalChain([prevState, 'access', _122 => _122.errors, 'optionalAccess', _123 => _123[routeId]]) !== error) {
|
|
8867
|
-
unstable_onError(error, {
|
|
8868
|
-
location: newState.location,
|
|
8869
|
-
params: _nullishCoalesce(_optionalChain([newState, 'access', _124 => _124.matches, 'access', _125 => _125[0], 'optionalAccess', _126 => _126.params]), () => ( {}))
|
|
8870
|
-
});
|
|
8871
|
-
}
|
|
8872
|
-
});
|
|
8873
|
-
}
|
|
8874
|
-
return newState;
|
|
8875
|
-
});
|
|
8876
|
-
},
|
|
8877
|
-
[unstable_onError]
|
|
8878
|
-
);
|
|
8879
8766
|
let setState = React9.useCallback(
|
|
8880
|
-
(newState, { deletedFetchers, flushSync, viewTransitionOpts }) => {
|
|
8767
|
+
(newState, { deletedFetchers, newErrors, flushSync, viewTransitionOpts }) => {
|
|
8768
|
+
if (newErrors && unstable_onError) {
|
|
8769
|
+
Object.values(newErrors).forEach(
|
|
8770
|
+
(error) => unstable_onError(error, {
|
|
8771
|
+
location: newState.location,
|
|
8772
|
+
params: _nullishCoalesce(_optionalChain([newState, 'access', _126 => _126.matches, 'access', _127 => _127[0], 'optionalAccess', _128 => _128.params]), () => ( {})),
|
|
8773
|
+
unstable_pattern: getRoutePattern(newState.matches)
|
|
8774
|
+
})
|
|
8775
|
+
);
|
|
8776
|
+
}
|
|
8881
8777
|
newState.fetchers.forEach((fetcher, key) => {
|
|
8882
8778
|
if (fetcher.data !== void 0) {
|
|
8883
8779
|
fetcherData.current.set(key, fetcher.data);
|
|
@@ -8895,16 +8791,23 @@ function RouterProvider({
|
|
|
8895
8791
|
);
|
|
8896
8792
|
if (!viewTransitionOpts || !isViewTransitionAvailable) {
|
|
8897
8793
|
if (reactDomFlushSyncImpl && flushSync) {
|
|
8898
|
-
reactDomFlushSyncImpl(() =>
|
|
8794
|
+
reactDomFlushSyncImpl(() => setStateImpl(newState));
|
|
8795
|
+
} else if (unstable_useTransitions === false) {
|
|
8796
|
+
setStateImpl(newState);
|
|
8899
8797
|
} else {
|
|
8900
|
-
React9.startTransition(() =>
|
|
8798
|
+
React9.startTransition(() => {
|
|
8799
|
+
if (unstable_useTransitions === true) {
|
|
8800
|
+
setOptimisticState((s) => getOptimisticRouterState(s, newState));
|
|
8801
|
+
}
|
|
8802
|
+
setStateImpl(newState);
|
|
8803
|
+
});
|
|
8901
8804
|
}
|
|
8902
8805
|
return;
|
|
8903
8806
|
}
|
|
8904
8807
|
if (reactDomFlushSyncImpl && flushSync) {
|
|
8905
8808
|
reactDomFlushSyncImpl(() => {
|
|
8906
8809
|
if (transition) {
|
|
8907
|
-
renderDfd
|
|
8810
|
+
_optionalChain([renderDfd, 'optionalAccess', _129 => _129.resolve, 'call', _130 => _130()]);
|
|
8908
8811
|
transition.skipTransition();
|
|
8909
8812
|
}
|
|
8910
8813
|
setVtContext({
|
|
@@ -8915,7 +8818,7 @@ function RouterProvider({
|
|
|
8915
8818
|
});
|
|
8916
8819
|
});
|
|
8917
8820
|
let t = router.window.document.startViewTransition(() => {
|
|
8918
|
-
reactDomFlushSyncImpl(() =>
|
|
8821
|
+
reactDomFlushSyncImpl(() => setStateImpl(newState));
|
|
8919
8822
|
});
|
|
8920
8823
|
t.finished.finally(() => {
|
|
8921
8824
|
reactDomFlushSyncImpl(() => {
|
|
@@ -8929,7 +8832,7 @@ function RouterProvider({
|
|
|
8929
8832
|
return;
|
|
8930
8833
|
}
|
|
8931
8834
|
if (transition) {
|
|
8932
|
-
renderDfd
|
|
8835
|
+
_optionalChain([renderDfd, 'optionalAccess', _131 => _131.resolve, 'call', _132 => _132()]);
|
|
8933
8836
|
transition.skipTransition();
|
|
8934
8837
|
setInterruption({
|
|
8935
8838
|
state: newState,
|
|
@@ -8951,7 +8854,9 @@ function RouterProvider({
|
|
|
8951
8854
|
reactDomFlushSyncImpl,
|
|
8952
8855
|
transition,
|
|
8953
8856
|
renderDfd,
|
|
8954
|
-
|
|
8857
|
+
unstable_useTransitions,
|
|
8858
|
+
setOptimisticState,
|
|
8859
|
+
unstable_onError
|
|
8955
8860
|
]
|
|
8956
8861
|
);
|
|
8957
8862
|
React9.useLayoutEffect(() => router.subscribe(setState), [router, setState]);
|
|
@@ -8965,7 +8870,16 @@ function RouterProvider({
|
|
|
8965
8870
|
let newState = pendingState;
|
|
8966
8871
|
let renderPromise = renderDfd.promise;
|
|
8967
8872
|
let transition2 = router.window.document.startViewTransition(async () => {
|
|
8968
|
-
|
|
8873
|
+
if (unstable_useTransitions === false) {
|
|
8874
|
+
setStateImpl(newState);
|
|
8875
|
+
} else {
|
|
8876
|
+
React9.startTransition(() => {
|
|
8877
|
+
if (unstable_useTransitions === true) {
|
|
8878
|
+
setOptimisticState((s) => getOptimisticRouterState(s, newState));
|
|
8879
|
+
}
|
|
8880
|
+
setStateImpl(newState);
|
|
8881
|
+
});
|
|
8882
|
+
}
|
|
8969
8883
|
await renderPromise;
|
|
8970
8884
|
});
|
|
8971
8885
|
transition2.finished.finally(() => {
|
|
@@ -8976,7 +8890,13 @@ function RouterProvider({
|
|
|
8976
8890
|
});
|
|
8977
8891
|
setTransition(transition2);
|
|
8978
8892
|
}
|
|
8979
|
-
}, [
|
|
8893
|
+
}, [
|
|
8894
|
+
pendingState,
|
|
8895
|
+
renderDfd,
|
|
8896
|
+
router.window,
|
|
8897
|
+
unstable_useTransitions,
|
|
8898
|
+
setOptimisticState
|
|
8899
|
+
]);
|
|
8980
8900
|
React9.useEffect(() => {
|
|
8981
8901
|
if (renderDfd && pendingState && state.location.key === pendingState.location.key) {
|
|
8982
8902
|
renderDfd.resolve();
|
|
@@ -9001,12 +8921,12 @@ function RouterProvider({
|
|
|
9001
8921
|
go: (n) => router.navigate(n),
|
|
9002
8922
|
push: (to, state2, opts) => router.navigate(to, {
|
|
9003
8923
|
state: state2,
|
|
9004
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess',
|
|
8924
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _133 => _133.preventScrollReset])
|
|
9005
8925
|
}),
|
|
9006
8926
|
replace: (to, state2, opts) => router.navigate(to, {
|
|
9007
8927
|
replace: true,
|
|
9008
8928
|
state: state2,
|
|
9009
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess',
|
|
8929
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _134 => _134.preventScrollReset])
|
|
9010
8930
|
})
|
|
9011
8931
|
};
|
|
9012
8932
|
}, [router]);
|
|
@@ -9027,7 +8947,8 @@ function RouterProvider({
|
|
|
9027
8947
|
basename,
|
|
9028
8948
|
location: state.location,
|
|
9029
8949
|
navigationType: state.historyAction,
|
|
9030
|
-
navigator
|
|
8950
|
+
navigator,
|
|
8951
|
+
unstable_useTransitions: unstable_useTransitions === true
|
|
9031
8952
|
},
|
|
9032
8953
|
/* @__PURE__ */ React9.createElement(
|
|
9033
8954
|
MemoizedDataRoutes,
|
|
@@ -9040,6 +8961,20 @@ function RouterProvider({
|
|
|
9040
8961
|
)
|
|
9041
8962
|
))))), null);
|
|
9042
8963
|
}
|
|
8964
|
+
function getOptimisticRouterState(currentState, newState) {
|
|
8965
|
+
return {
|
|
8966
|
+
// Don't surface "current location specific" stuff mid-navigation
|
|
8967
|
+
// (historyAction, location, matches, loaderData, errors, initialized,
|
|
8968
|
+
// restoreScroll, preventScrollReset, blockers, etc.)
|
|
8969
|
+
...currentState,
|
|
8970
|
+
// Only surface "pending/in-flight stuff"
|
|
8971
|
+
// (navigation, revalidation, actionData, fetchers, )
|
|
8972
|
+
navigation: newState.navigation.state !== "idle" ? newState.navigation : currentState.navigation,
|
|
8973
|
+
revalidation: newState.revalidation !== "idle" ? newState.revalidation : currentState.revalidation,
|
|
8974
|
+
actionData: newState.navigation.state !== "submitting" ? newState.actionData : currentState.actionData,
|
|
8975
|
+
fetchers: newState.fetchers
|
|
8976
|
+
};
|
|
8977
|
+
}
|
|
9043
8978
|
var MemoizedDataRoutes = React9.memo(DataRoutes);
|
|
9044
8979
|
function DataRoutes({
|
|
9045
8980
|
routes,
|
|
@@ -9053,7 +8988,8 @@ function MemoryRouter({
|
|
|
9053
8988
|
basename,
|
|
9054
8989
|
children,
|
|
9055
8990
|
initialEntries,
|
|
9056
|
-
initialIndex
|
|
8991
|
+
initialIndex,
|
|
8992
|
+
unstable_useTransitions
|
|
9057
8993
|
}) {
|
|
9058
8994
|
let historyRef = React9.useRef();
|
|
9059
8995
|
if (historyRef.current == null) {
|
|
@@ -9070,9 +9006,13 @@ function MemoryRouter({
|
|
|
9070
9006
|
});
|
|
9071
9007
|
let setState = React9.useCallback(
|
|
9072
9008
|
(newState) => {
|
|
9073
|
-
|
|
9009
|
+
if (unstable_useTransitions === false) {
|
|
9010
|
+
setStateImpl(newState);
|
|
9011
|
+
} else {
|
|
9012
|
+
React9.startTransition(() => setStateImpl(newState));
|
|
9013
|
+
}
|
|
9074
9014
|
},
|
|
9075
|
-
[
|
|
9015
|
+
[unstable_useTransitions]
|
|
9076
9016
|
);
|
|
9077
9017
|
React9.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
9078
9018
|
return /* @__PURE__ */ React9.createElement(
|
|
@@ -9082,7 +9022,8 @@ function MemoryRouter({
|
|
|
9082
9022
|
children,
|
|
9083
9023
|
location: state.location,
|
|
9084
9024
|
navigationType: state.action,
|
|
9085
|
-
navigator: history
|
|
9025
|
+
navigator: history,
|
|
9026
|
+
unstable_useTransitions: unstable_useTransitions === true
|
|
9086
9027
|
}
|
|
9087
9028
|
);
|
|
9088
9029
|
}
|
|
@@ -9133,7 +9074,8 @@ function Router({
|
|
|
9133
9074
|
location: locationProp,
|
|
9134
9075
|
navigationType = "POP" /* Pop */,
|
|
9135
9076
|
navigator,
|
|
9136
|
-
static: staticProp = false
|
|
9077
|
+
static: staticProp = false,
|
|
9078
|
+
unstable_useTransitions
|
|
9137
9079
|
}) {
|
|
9138
9080
|
invariant(
|
|
9139
9081
|
!useInRouterContext(),
|
|
@@ -9145,9 +9087,10 @@ function Router({
|
|
|
9145
9087
|
basename,
|
|
9146
9088
|
navigator,
|
|
9147
9089
|
static: staticProp,
|
|
9090
|
+
unstable_useTransitions,
|
|
9148
9091
|
future: {}
|
|
9149
9092
|
}),
|
|
9150
|
-
[basename, navigator, staticProp]
|
|
9093
|
+
[basename, navigator, staticProp, unstable_useTransitions]
|
|
9151
9094
|
);
|
|
9152
9095
|
if (typeof locationProp === "string") {
|
|
9153
9096
|
locationProp = parsePath(locationProp);
|
|
@@ -9202,7 +9145,8 @@ function Await({
|
|
|
9202
9145
|
if (dataRouterContext && dataRouterContext.unstable_onError && dataRouterStateContext) {
|
|
9203
9146
|
dataRouterContext.unstable_onError(error, {
|
|
9204
9147
|
location: dataRouterStateContext.location,
|
|
9205
|
-
params: _optionalChain([dataRouterStateContext, 'access',
|
|
9148
|
+
params: _optionalChain([dataRouterStateContext, 'access', _135 => _135.matches, 'access', _136 => _136[0], 'optionalAccess', _137 => _137.params]) || {},
|
|
9149
|
+
unstable_pattern: getRoutePattern(dataRouterStateContext.matches),
|
|
9206
9150
|
errorInfo
|
|
9207
9151
|
});
|
|
9208
9152
|
}
|
|
@@ -9263,7 +9207,7 @@ var AwaitErrorBoundary = class extends React9.Component {
|
|
|
9263
9207
|
promise = resolve.then(
|
|
9264
9208
|
(data2) => Object.defineProperty(resolve, "_data", { get: () => data2 }),
|
|
9265
9209
|
(error) => {
|
|
9266
|
-
_optionalChain([this, 'access',
|
|
9210
|
+
_optionalChain([this, 'access', _138 => _138.props, 'access', _139 => _139.onError, 'optionalCall', _140 => _140(error)]);
|
|
9267
9211
|
Object.defineProperty(resolve, "_error", { get: () => error });
|
|
9268
9212
|
}
|
|
9269
9213
|
);
|
|
@@ -9522,5 +9466,4 @@ function withErrorBoundaryProps(ErrorBoundary) {
|
|
|
9522
9466
|
|
|
9523
9467
|
|
|
9524
9468
|
|
|
9525
|
-
|
|
9526
|
-
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.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.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.UNSTABLE_TransitionEnabledRouterProvider = UNSTABLE_TransitionEnabledRouterProvider; 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;
|
|
9469
|
+
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.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.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;
|