@remix-run/router 1.14.2 → 1.15.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 +15 -8
- package/dist/router.cjs.js +13 -7
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.d.ts +1 -0
- package/dist/router.js +13 -7
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +13 -7
- package/dist/router.umd.js.map +1 -1
- package/dist/router.umd.min.js +2 -2
- package/dist/router.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/router.ts +18 -9
package/dist/router.d.ts
CHANGED
|
@@ -487,6 +487,7 @@ export declare const UNSAFE_DEFERRED_SYMBOL: unique symbol;
|
|
|
487
487
|
*/
|
|
488
488
|
export interface StaticHandlerFutureConfig {
|
|
489
489
|
v7_relativeSplatPath: boolean;
|
|
490
|
+
v7_throwAbortReason: boolean;
|
|
490
491
|
}
|
|
491
492
|
export interface CreateStaticHandlerOptions {
|
|
492
493
|
basename?: string;
|
package/dist/router.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.
|
|
2
|
+
* @remix-run/router v1.15.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2822,7 +2822,8 @@ function createStaticHandler(routes, opts) {
|
|
|
2822
2822
|
}
|
|
2823
2823
|
// Config driven behavior flags
|
|
2824
2824
|
let future = _extends({
|
|
2825
|
-
v7_relativeSplatPath: false
|
|
2825
|
+
v7_relativeSplatPath: false,
|
|
2826
|
+
v7_throwAbortReason: false
|
|
2826
2827
|
}, opts ? opts.future : null);
|
|
2827
2828
|
let dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties, undefined, manifest);
|
|
2828
2829
|
/**
|
|
@@ -3039,8 +3040,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3039
3040
|
requestContext
|
|
3040
3041
|
});
|
|
3041
3042
|
if (request.signal.aborted) {
|
|
3042
|
-
|
|
3043
|
-
throw new Error(method + "() call aborted: " + request.method + " " + request.url);
|
|
3043
|
+
throwStaticHandlerAbortedError(request, isRouteRequest, future);
|
|
3044
3044
|
}
|
|
3045
3045
|
}
|
|
3046
3046
|
if (isRedirectResult(result)) {
|
|
@@ -3154,8 +3154,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3154
3154
|
requestContext
|
|
3155
3155
|
}))]);
|
|
3156
3156
|
if (request.signal.aborted) {
|
|
3157
|
-
|
|
3158
|
-
throw new Error(method + "() call aborted: " + request.method + " " + request.url);
|
|
3157
|
+
throwStaticHandlerAbortedError(request, isRouteRequest, future);
|
|
3159
3158
|
}
|
|
3160
3159
|
// Process and commit output from loaders
|
|
3161
3160
|
let activeDeferreds = new Map();
|
|
@@ -3188,13 +3187,20 @@ function createStaticHandler(routes, opts) {
|
|
|
3188
3187
|
*/
|
|
3189
3188
|
function getStaticContextFromError(routes, context, error) {
|
|
3190
3189
|
let newContext = _extends({}, context, {
|
|
3191
|
-
statusCode: 500,
|
|
3190
|
+
statusCode: isRouteErrorResponse(error) ? error.status : 500,
|
|
3192
3191
|
errors: {
|
|
3193
3192
|
[context._deepestRenderedBoundaryId || routes[0].id]: error
|
|
3194
3193
|
}
|
|
3195
3194
|
});
|
|
3196
3195
|
return newContext;
|
|
3197
3196
|
}
|
|
3197
|
+
function throwStaticHandlerAbortedError(request, isRouteRequest, future) {
|
|
3198
|
+
if (future.v7_throwAbortReason && request.signal.reason !== undefined) {
|
|
3199
|
+
throw request.signal.reason;
|
|
3200
|
+
}
|
|
3201
|
+
let method = isRouteRequest ? "queryRoute" : "query";
|
|
3202
|
+
throw new Error(method + "() call aborted: " + request.method + " " + request.url);
|
|
3203
|
+
}
|
|
3198
3204
|
function isSubmissionNavigation(opts) {
|
|
3199
3205
|
return opts != null && ("formData" in opts && opts.formData != null || "body" in opts && opts.body !== undefined);
|
|
3200
3206
|
}
|