react-router 7.8.1 → 7.8.2-pre.1
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 +23 -0
- package/dist/development/{chunk-IFMMFE4R.mjs → chunk-7QFLQWWN.mjs} +34 -75
- package/dist/{production/chunk-YMYXECPK.js → development/chunk-IVOVRAK2.js} +210 -169
- package/dist/development/{chunk-UH6JLGW7.mjs → chunk-ZVD2KUIM.mjs} +187 -204
- package/dist/development/{chunk-TGXCWGPT.js → chunk-ZVMYUFGA.js} +125 -183
- package/dist/development/{context-DohQKLID.d.mts → context-jKip1TFB.d.mts} +846 -8
- package/dist/development/dom-export.d.mts +20 -2
- package/dist/development/dom-export.d.ts +20 -1
- package/dist/development/dom-export.js +10 -4
- package/dist/development/dom-export.mjs +10 -4
- package/dist/{production/index-react-server-client-BQ6FxdA_.d.ts → development/index-react-server-client-BKpa2trA.d.ts} +6 -816
- package/dist/{production/index-react-server-client-11fLy3qB.d.mts → development/index-react-server-client-DRhjXpk2.d.mts} +2 -3
- package/dist/development/index-react-server-client.d.mts +3 -4
- 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 -3
- package/dist/development/index-react-server.d.ts +4 -3
- package/dist/development/index-react-server.js +62 -53
- package/dist/development/index-react-server.mjs +62 -53
- package/dist/development/index.d.mts +7 -9
- package/dist/development/index.d.ts +5 -5
- package/dist/development/index.js +122 -163
- package/dist/development/index.mjs +3 -3
- package/dist/development/lib/types/internal.d.mts +3 -3
- 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/{route-data-CNjObrhZ.d.mts → route-data-DAVP2QQ0.d.mts} +3 -3
- package/dist/development/{routeModules-C3oqzPpI.d.ts → routeModules-rOzWJJ9x.d.ts} +848 -10
- package/dist/production/{chunk-KHPQXKYM.js → chunk-5WPGWA23.js} +125 -183
- package/dist/{development/chunk-IIA3TUI2.js → production/chunk-IK7IYG3O.js} +210 -169
- package/dist/production/{chunk-5Y7ELDIJ.mjs → chunk-LR4OTIMG.mjs} +34 -75
- package/dist/production/{chunk-PFDCNQUK.mjs → chunk-VHBXOG2Z.mjs} +187 -204
- package/dist/production/{context-DohQKLID.d.mts → context-jKip1TFB.d.mts} +846 -8
- package/dist/production/dom-export.d.mts +20 -2
- package/dist/production/dom-export.d.ts +20 -1
- package/dist/production/dom-export.js +10 -4
- package/dist/production/dom-export.mjs +10 -4
- package/dist/{development/index-react-server-client-BQ6FxdA_.d.ts → production/index-react-server-client-BKpa2trA.d.ts} +6 -816
- package/dist/{development/index-react-server-client-11fLy3qB.d.mts → production/index-react-server-client-DRhjXpk2.d.mts} +2 -3
- package/dist/production/index-react-server-client.d.mts +3 -4
- 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 -3
- package/dist/production/index-react-server.d.ts +4 -3
- package/dist/production/index-react-server.js +62 -53
- package/dist/production/index-react-server.mjs +62 -53
- package/dist/production/index.d.mts +7 -9
- package/dist/production/index.d.ts +5 -5
- package/dist/production/index.js +122 -163
- package/dist/production/index.mjs +3 -3
- package/dist/production/lib/types/internal.d.mts +3 -3
- 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/{route-data-CNjObrhZ.d.mts → route-data-DAVP2QQ0.d.mts} +3 -3
- package/dist/production/{routeModules-C3oqzPpI.d.ts → routeModules-rOzWJJ9x.d.ts} +848 -10
- package/package.json +1 -1
- package/dist/development/components-CuPfnyiZ.d.mts +0 -814
- package/dist/production/components-CuPfnyiZ.d.mts +0 -814
|
@@ -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.8.1
|
|
2
|
+
* react-router v7.8.2-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -699,7 +699,7 @@ function generatePath(originalPath, params = {}) {
|
|
|
699
699
|
const [, key, optional] = keyMatch;
|
|
700
700
|
let param = params[key];
|
|
701
701
|
invariant(optional === "?" || param != null, `Missing ":${key}" param`);
|
|
702
|
-
return stringify2(param);
|
|
702
|
+
return encodeURIComponent(stringify2(param));
|
|
703
703
|
}
|
|
704
704
|
return segment.replace(/\?$/g, "");
|
|
705
705
|
}).filter((segment) => !!segment);
|
|
@@ -1004,9 +1004,11 @@ function createRouter(init) {
|
|
|
1004
1004
|
);
|
|
1005
1005
|
let inFlightDataRoutes;
|
|
1006
1006
|
let basename = init.basename || "/";
|
|
1007
|
+
if (!basename.startsWith("/")) {
|
|
1008
|
+
basename = `/${basename}`;
|
|
1009
|
+
}
|
|
1007
1010
|
let dataStrategyImpl = init.dataStrategy || defaultDataStrategyWithMiddleware;
|
|
1008
1011
|
let future = {
|
|
1009
|
-
unstable_middleware: false,
|
|
1010
1012
|
...init.future
|
|
1011
1013
|
};
|
|
1012
1014
|
let unlistenHistory = null;
|
|
@@ -1553,6 +1555,19 @@ function createRouter(init) {
|
|
|
1553
1555
|
if (discoverResult.type === "aborted") {
|
|
1554
1556
|
return { shortCircuited: true };
|
|
1555
1557
|
} else if (discoverResult.type === "error") {
|
|
1558
|
+
if (discoverResult.partialMatches.length === 0) {
|
|
1559
|
+
let { matches: matches2, route } = getShortCircuitMatches(dataRoutes);
|
|
1560
|
+
return {
|
|
1561
|
+
matches: matches2,
|
|
1562
|
+
pendingActionResult: [
|
|
1563
|
+
route.id,
|
|
1564
|
+
{
|
|
1565
|
+
type: "error" /* error */,
|
|
1566
|
+
error: discoverResult.error
|
|
1567
|
+
}
|
|
1568
|
+
]
|
|
1569
|
+
};
|
|
1570
|
+
}
|
|
1556
1571
|
let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;
|
|
1557
1572
|
return {
|
|
1558
1573
|
matches: discoverResult.partialMatches,
|
|
@@ -1684,6 +1699,16 @@ function createRouter(init) {
|
|
|
1684
1699
|
if (discoverResult.type === "aborted") {
|
|
1685
1700
|
return { shortCircuited: true };
|
|
1686
1701
|
} else if (discoverResult.type === "error") {
|
|
1702
|
+
if (discoverResult.partialMatches.length === 0) {
|
|
1703
|
+
let { matches: matches2, route } = getShortCircuitMatches(dataRoutes);
|
|
1704
|
+
return {
|
|
1705
|
+
matches: matches2,
|
|
1706
|
+
loaderData: {},
|
|
1707
|
+
errors: {
|
|
1708
|
+
[route.id]: discoverResult.error
|
|
1709
|
+
}
|
|
1710
|
+
};
|
|
1711
|
+
}
|
|
1687
1712
|
let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;
|
|
1688
1713
|
return {
|
|
1689
1714
|
matches: discoverResult.partialMatches,
|
|
@@ -2801,7 +2826,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2801
2826
|
},
|
|
2802
2827
|
async () => {
|
|
2803
2828
|
let res = await generateMiddlewareResponse(
|
|
2804
|
-
async (revalidationRequest) => {
|
|
2829
|
+
async (revalidationRequest, opts2 = {}) => {
|
|
2805
2830
|
let result2 = await queryImpl(
|
|
2806
2831
|
revalidationRequest,
|
|
2807
2832
|
location,
|
|
@@ -2810,7 +2835,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2810
2835
|
dataStrategy || null,
|
|
2811
2836
|
skipLoaderErrorBubbling === true,
|
|
2812
2837
|
null,
|
|
2813
|
-
filterMatchesToLoad
|
|
2838
|
+
"filterMatchesToLoad" in opts2 ? _nullishCoalesce(opts2.filterMatchesToLoad, () => ( null)) : null,
|
|
2814
2839
|
skipRevalidation === true
|
|
2815
2840
|
);
|
|
2816
2841
|
if (isResponse(result2)) {
|
|
@@ -3947,198 +3972,116 @@ async function defaultDataStrategyWithMiddleware(args) {
|
|
|
3947
3972
|
if (!args.matches.some((m) => m.route.unstable_middleware)) {
|
|
3948
3973
|
return defaultDataStrategy(args);
|
|
3949
3974
|
}
|
|
3950
|
-
|
|
3951
|
-
|
|
3975
|
+
return runClientMiddlewarePipeline(args, () => defaultDataStrategy(args));
|
|
3976
|
+
}
|
|
3977
|
+
function runServerMiddlewarePipeline(args, handler, errorHandler) {
|
|
3978
|
+
return runMiddlewarePipeline(
|
|
3952
3979
|
args,
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
(error, routeId) => clientMiddlewareErrorHandler(
|
|
3958
|
-
error,
|
|
3959
|
-
routeId,
|
|
3960
|
-
args.matches,
|
|
3961
|
-
didCallHandler
|
|
3962
|
-
)
|
|
3980
|
+
handler,
|
|
3981
|
+
processResult,
|
|
3982
|
+
isResponse,
|
|
3983
|
+
errorHandler
|
|
3963
3984
|
);
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
if (didCallHandler) {
|
|
3967
|
-
return {
|
|
3968
|
-
[routeId]: { type: "error", result: error }
|
|
3969
|
-
};
|
|
3970
|
-
} else {
|
|
3971
|
-
let maxBoundaryIdx = Math.min(
|
|
3972
|
-
// Throwing route
|
|
3973
|
-
matches.findIndex((m) => m.route.id === routeId) || 0,
|
|
3974
|
-
// or the shallowest route that needs to load data
|
|
3975
|
-
matches.findIndex((m) => m.unstable_shouldCallHandler()) || 0
|
|
3976
|
-
);
|
|
3977
|
-
let boundaryRouteId = findNearestBoundary(
|
|
3978
|
-
matches,
|
|
3979
|
-
matches[maxBoundaryIdx].route.id
|
|
3980
|
-
).route.id;
|
|
3981
|
-
return {
|
|
3982
|
-
[boundaryRouteId]: { type: "error", result: error }
|
|
3983
|
-
};
|
|
3985
|
+
function processResult(result) {
|
|
3986
|
+
return isDataWithResponseInit(result) ? dataWithResponseInitToResponse(result) : result;
|
|
3984
3987
|
}
|
|
3985
3988
|
}
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
(m) => m.route.unstable_middleware ? m.route.unstable_middleware.map((fn) => [m.route.id, fn]) : []
|
|
3990
|
-
);
|
|
3991
|
-
let result = await callServerRouteMiddleware(
|
|
3992
|
-
{ request, params, context },
|
|
3993
|
-
tuples,
|
|
3989
|
+
function runClientMiddlewarePipeline(args, handler) {
|
|
3990
|
+
return runMiddlewarePipeline(
|
|
3991
|
+
args,
|
|
3994
3992
|
handler,
|
|
3993
|
+
(r) => r,
|
|
3994
|
+
// No post-processing needed on the client
|
|
3995
|
+
isDataStrategyResults,
|
|
3995
3996
|
errorHandler
|
|
3996
3997
|
);
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
}
|
|
4002
|
-
|
|
4003
|
-
let { request } = args;
|
|
4004
|
-
if (request.signal.aborted) {
|
|
4005
|
-
if (request.signal.reason) {
|
|
4006
|
-
throw request.signal.reason;
|
|
4007
|
-
}
|
|
4008
|
-
throw new Error(
|
|
4009
|
-
`Request aborted without an \`AbortSignal.reason\`: ${request.method} ${request.url}`
|
|
4010
|
-
);
|
|
4011
|
-
}
|
|
4012
|
-
let tuple = middlewares[idx];
|
|
4013
|
-
if (!tuple) {
|
|
4014
|
-
let result = await handler();
|
|
4015
|
-
return result;
|
|
4016
|
-
}
|
|
4017
|
-
let [routeId, middleware] = tuple;
|
|
4018
|
-
let nextCalled = false;
|
|
4019
|
-
let nextResult = void 0;
|
|
4020
|
-
let next = async () => {
|
|
4021
|
-
if (nextCalled) {
|
|
4022
|
-
throw new Error("You may only call `next()` once per middleware");
|
|
4023
|
-
}
|
|
4024
|
-
nextCalled = true;
|
|
4025
|
-
try {
|
|
4026
|
-
let result = await callServerRouteMiddleware(
|
|
4027
|
-
args,
|
|
4028
|
-
middlewares,
|
|
4029
|
-
handler,
|
|
4030
|
-
errorHandler,
|
|
4031
|
-
idx + 1
|
|
3998
|
+
function errorHandler(error, routeId, nextResult) {
|
|
3999
|
+
if (nextResult) {
|
|
4000
|
+
return Promise.resolve(
|
|
4001
|
+
Object.assign(nextResult.value, {
|
|
4002
|
+
[routeId]: { type: "error", result: error }
|
|
4003
|
+
})
|
|
4032
4004
|
);
|
|
4033
|
-
if (isDataWithResponseInit(result)) {
|
|
4034
|
-
result = dataWithResponseInitToResponse(result);
|
|
4035
|
-
}
|
|
4036
|
-
nextResult = result;
|
|
4037
|
-
return nextResult;
|
|
4038
|
-
} catch (e) {
|
|
4039
|
-
nextResult = await errorHandler(e, routeId);
|
|
4040
|
-
return nextResult;
|
|
4041
|
-
}
|
|
4042
|
-
};
|
|
4043
|
-
try {
|
|
4044
|
-
let result = await middleware(
|
|
4045
|
-
{
|
|
4046
|
-
request: args.request,
|
|
4047
|
-
params: args.params,
|
|
4048
|
-
context: args.context
|
|
4049
|
-
},
|
|
4050
|
-
next
|
|
4051
|
-
);
|
|
4052
|
-
if (isDataWithResponseInit(result)) {
|
|
4053
|
-
result = dataWithResponseInitToResponse(result);
|
|
4054
|
-
}
|
|
4055
|
-
if (nextCalled) {
|
|
4056
|
-
return typeof result === "undefined" ? nextResult : result;
|
|
4057
|
-
} else if (isResponse(result)) {
|
|
4058
|
-
return result;
|
|
4059
4005
|
} else {
|
|
4060
|
-
|
|
4061
|
-
|
|
4006
|
+
let { matches } = args;
|
|
4007
|
+
let maxBoundaryIdx = Math.min(
|
|
4008
|
+
// Throwing route
|
|
4009
|
+
matches.findIndex((m) => m.route.id === routeId) || 0,
|
|
4010
|
+
// or the shallowest route that needs to load data
|
|
4011
|
+
matches.findIndex((m) => m.unstable_shouldCallHandler()) || 0
|
|
4012
|
+
);
|
|
4013
|
+
let boundaryRouteId = findNearestBoundary(
|
|
4014
|
+
matches,
|
|
4015
|
+
matches[maxBoundaryIdx].route.id
|
|
4016
|
+
).route.id;
|
|
4017
|
+
return Promise.resolve({
|
|
4018
|
+
[boundaryRouteId]: { type: "error", result: error }
|
|
4019
|
+
});
|
|
4062
4020
|
}
|
|
4063
|
-
} catch (e) {
|
|
4064
|
-
let response = await errorHandler(e, routeId);
|
|
4065
|
-
return response;
|
|
4066
4021
|
}
|
|
4067
4022
|
}
|
|
4068
|
-
async function
|
|
4023
|
+
async function runMiddlewarePipeline(args, handler, processResult, isResult, errorHandler) {
|
|
4069
4024
|
let { matches, request, params, context } = args;
|
|
4070
4025
|
let tuples = matches.flatMap(
|
|
4071
4026
|
(m) => m.route.unstable_middleware ? m.route.unstable_middleware.map((fn) => [m.route.id, fn]) : []
|
|
4072
4027
|
);
|
|
4073
|
-
let
|
|
4074
|
-
await callClientRouteMiddleware(
|
|
4028
|
+
let result = await callRouteMiddleware(
|
|
4075
4029
|
{ request, params, context },
|
|
4076
4030
|
tuples,
|
|
4077
4031
|
handler,
|
|
4078
|
-
|
|
4079
|
-
|
|
4032
|
+
processResult,
|
|
4033
|
+
isResult,
|
|
4034
|
+
errorHandler
|
|
4080
4035
|
);
|
|
4081
|
-
return
|
|
4036
|
+
return result;
|
|
4082
4037
|
}
|
|
4083
|
-
async function
|
|
4038
|
+
async function callRouteMiddleware(args, middlewares, handler, processResult, isResult, errorHandler, idx = 0) {
|
|
4084
4039
|
let { request } = args;
|
|
4085
4040
|
if (request.signal.aborted) {
|
|
4086
|
-
|
|
4087
|
-
throw request.signal.reason;
|
|
4088
|
-
}
|
|
4089
|
-
throw new Error(
|
|
4090
|
-
`Request aborted without an \`AbortSignal.reason\`: ${request.method} ${request.url}`
|
|
4091
|
-
);
|
|
4041
|
+
throw _nullishCoalesce(request.signal.reason, () => ( new Error(`Request aborted: ${request.method} ${request.url}`)));
|
|
4092
4042
|
}
|
|
4093
4043
|
let tuple = middlewares[idx];
|
|
4094
4044
|
if (!tuple) {
|
|
4095
4045
|
let result = await handler();
|
|
4096
|
-
|
|
4097
|
-
return;
|
|
4046
|
+
return result;
|
|
4098
4047
|
}
|
|
4099
4048
|
let [routeId, middleware] = tuple;
|
|
4100
|
-
let
|
|
4049
|
+
let nextResult;
|
|
4101
4050
|
let next = async () => {
|
|
4102
|
-
if (
|
|
4051
|
+
if (nextResult) {
|
|
4103
4052
|
throw new Error("You may only call `next()` once per middleware");
|
|
4104
4053
|
}
|
|
4105
|
-
nextCalled = true;
|
|
4106
4054
|
try {
|
|
4107
|
-
let result = await
|
|
4055
|
+
let result = await callRouteMiddleware(
|
|
4108
4056
|
args,
|
|
4109
4057
|
middlewares,
|
|
4110
4058
|
handler,
|
|
4059
|
+
processResult,
|
|
4060
|
+
isResult,
|
|
4111
4061
|
errorHandler,
|
|
4112
|
-
handlerResult,
|
|
4113
4062
|
idx + 1
|
|
4114
4063
|
);
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4064
|
+
nextResult = { value: result };
|
|
4065
|
+
return nextResult.value;
|
|
4066
|
+
} catch (error) {
|
|
4067
|
+
nextResult = { value: await errorHandler(error, routeId, nextResult) };
|
|
4068
|
+
return nextResult.value;
|
|
4119
4069
|
}
|
|
4120
4070
|
};
|
|
4121
4071
|
try {
|
|
4122
|
-
let
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
console.warn(
|
|
4132
|
-
"client middlewares are not intended to return values, the value will be ignored",
|
|
4133
|
-
result
|
|
4134
|
-
);
|
|
4135
|
-
}
|
|
4136
|
-
if (!nextCalled) {
|
|
4137
|
-
await next();
|
|
4072
|
+
let value = await middleware(args, next);
|
|
4073
|
+
let result = value != null ? processResult(value) : void 0;
|
|
4074
|
+
if (isResult(result)) {
|
|
4075
|
+
return result;
|
|
4076
|
+
} else if (nextResult) {
|
|
4077
|
+
return _nullishCoalesce(result, () => ( nextResult.value));
|
|
4078
|
+
} else {
|
|
4079
|
+
nextResult = { value: await next() };
|
|
4080
|
+
return nextResult.value;
|
|
4138
4081
|
}
|
|
4139
4082
|
} catch (error) {
|
|
4140
|
-
let
|
|
4141
|
-
|
|
4083
|
+
let response = await errorHandler(error, routeId, nextResult);
|
|
4084
|
+
return response;
|
|
4142
4085
|
}
|
|
4143
4086
|
}
|
|
4144
4087
|
function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip) {
|
|
@@ -4249,28 +4192,17 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4249
4192
|
);
|
|
4250
4193
|
} : (cb) => {
|
|
4251
4194
|
let typedDataStrategyArgs = dataStrategyArgs;
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
);
|
|
4264
|
-
}
|
|
4265
|
-
});
|
|
4266
|
-
},
|
|
4267
|
-
(error, routeId) => clientMiddlewareErrorHandler(
|
|
4268
|
-
error,
|
|
4269
|
-
routeId,
|
|
4270
|
-
matches,
|
|
4271
|
-
didCallHandler
|
|
4272
|
-
)
|
|
4273
|
-
);
|
|
4195
|
+
return runClientMiddlewarePipeline(typedDataStrategyArgs, () => {
|
|
4196
|
+
return cb({
|
|
4197
|
+
...typedDataStrategyArgs,
|
|
4198
|
+
fetcherKey,
|
|
4199
|
+
unstable_runClientMiddleware: () => {
|
|
4200
|
+
throw new Error(
|
|
4201
|
+
"Cannot call `unstable_runClientMiddleware()` from within an `unstable_runClientMiddleware` handler"
|
|
4202
|
+
);
|
|
4203
|
+
}
|
|
4204
|
+
});
|
|
4205
|
+
});
|
|
4274
4206
|
};
|
|
4275
4207
|
let results = await dataStrategyImpl({
|
|
4276
4208
|
...dataStrategyArgs,
|
|
@@ -4738,6 +4670,11 @@ function dataWithResponseInitToErrorResponse(data2) {
|
|
|
4738
4670
|
data2.data
|
|
4739
4671
|
);
|
|
4740
4672
|
}
|
|
4673
|
+
function isDataStrategyResults(result) {
|
|
4674
|
+
return result != null && typeof result === "object" && Object.entries(result).every(
|
|
4675
|
+
([key, value]) => typeof key === "string" && isDataStrategyResult(value)
|
|
4676
|
+
);
|
|
4677
|
+
}
|
|
4741
4678
|
function isDataStrategyResult(result) {
|
|
4742
4679
|
return result != null && typeof result === "object" && "type" in result && "result" in result && (result.type === "data" /* data */ || result.type === "error" /* error */);
|
|
4743
4680
|
}
|
|
@@ -6326,7 +6263,7 @@ function useResolvedPath(to, { relative } = {}) {
|
|
|
6326
6263
|
function useRoutes(routes, locationArg) {
|
|
6327
6264
|
return useRoutesImpl(routes, locationArg);
|
|
6328
6265
|
}
|
|
6329
|
-
function useRoutesImpl(routes, locationArg, dataRouterState, future) {
|
|
6266
|
+
function useRoutesImpl(routes, locationArg, dataRouterState, unstable_onError, future) {
|
|
6330
6267
|
invariant(
|
|
6331
6268
|
useInRouterContext(),
|
|
6332
6269
|
// TODO: This error is probably because they somehow have 2 versions of the
|
|
@@ -6398,6 +6335,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
6398
6335
|
),
|
|
6399
6336
|
parentMatches,
|
|
6400
6337
|
dataRouterState,
|
|
6338
|
+
unstable_onError,
|
|
6401
6339
|
future
|
|
6402
6340
|
);
|
|
6403
6341
|
if (locationArg && renderedMatches) {
|
|
@@ -6466,11 +6404,14 @@ var RenderErrorBoundary = class extends React3.Component {
|
|
|
6466
6404
|
};
|
|
6467
6405
|
}
|
|
6468
6406
|
componentDidCatch(error, errorInfo) {
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6407
|
+
if (this.props.unstable_onError) {
|
|
6408
|
+
this.props.unstable_onError(error, errorInfo);
|
|
6409
|
+
} else {
|
|
6410
|
+
console.error(
|
|
6411
|
+
"React Router caught the following error during render",
|
|
6412
|
+
error
|
|
6413
|
+
);
|
|
6414
|
+
}
|
|
6474
6415
|
}
|
|
6475
6416
|
render() {
|
|
6476
6417
|
return this.state.error !== void 0 ? /* @__PURE__ */ React3.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ React3.createElement(
|
|
@@ -6489,7 +6430,7 @@ function RenderedRoute({ routeContext, match, children }) {
|
|
|
6489
6430
|
}
|
|
6490
6431
|
return /* @__PURE__ */ React3.createElement(RouteContext.Provider, { value: routeContext }, children);
|
|
6491
6432
|
}
|
|
6492
|
-
function _renderMatches(matches, parentMatches = [], dataRouterState = null, future = null) {
|
|
6433
|
+
function _renderMatches(matches, parentMatches = [], dataRouterState = null, unstable_onError = null, future = null) {
|
|
6493
6434
|
if (matches == null) {
|
|
6494
6435
|
if (!dataRouterState) {
|
|
6495
6436
|
return null;
|
|
@@ -6601,7 +6542,8 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, fut
|
|
|
6601
6542
|
component: errorElement,
|
|
6602
6543
|
error,
|
|
6603
6544
|
children: getChildren(),
|
|
6604
|
-
routeContext: { outlet: null, matches: matches2, isDataRoute: true }
|
|
6545
|
+
routeContext: { outlet: null, matches: matches2, isDataRoute: true },
|
|
6546
|
+
unstable_onError
|
|
6605
6547
|
}
|
|
6606
6548
|
) : getChildren();
|
|
6607
6549
|
},
|