@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# `@remix-run/router`
|
|
2
2
|
|
|
3
|
+
## 1.15.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add a `createStaticHandler` `future.v7_throwAbortReason` flag to throw `request.signal.reason` (defaults to a `DOMException`) when a request is aborted instead of an `Error` such as `new Error("query() call aborted: GET /path")` ([#11104](https://github.com/remix-run/react-router/pull/11104))
|
|
8
|
+
|
|
9
|
+
- Please note that `DOMException` was added in Node v17 so you will not get a `DOMException` on Node 16 and below.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Respect the `ErrorResponse` status code if passed to `getStaticContextFormError` ([#11213](https://github.com/remix-run/react-router/pull/11213))
|
|
14
|
+
|
|
3
15
|
## 1.14.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -200,7 +212,7 @@
|
|
|
200
212
|
|
|
201
213
|
### Patch Changes
|
|
202
214
|
|
|
203
|
-
- Revert the `useResolvedPath` fix for splat routes due to a large number of applications that were relying on the buggy behavior (see https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329). We plan to re-introduce this fix behind a future flag in the next minor version. ([#11078](https://github.com/remix-run/react-router/pull/11078))
|
|
215
|
+
- Revert the `useResolvedPath` fix for splat routes due to a large number of applications that were relying on the buggy behavior (see <https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329>). We plan to re-introduce this fix behind a future flag in the next minor version. ([#11078](https://github.com/remix-run/react-router/pull/11078))
|
|
204
216
|
|
|
205
217
|
## 1.13.0
|
|
206
218
|
|
|
@@ -680,11 +692,6 @@ function Comp() {
|
|
|
680
692
|
|
|
681
693
|
This is the first stable release of `@remix-run/router`, which provides all the underlying routing and data loading/mutation logic for `react-router`. You should _not_ be using this package directly unless you are authoring a routing library similar to `react-router`.
|
|
682
694
|
|
|
683
|
-
For an overview of the features provided by `react-router`, we recommend you go check out the [docs]
|
|
684
|
-
|
|
685
|
-
For an overview of the features provided by `@remix-run/router`, please check out the [`README`][remix-router-readme].
|
|
695
|
+
For an overview of the features provided by `react-router`, we recommend you go check out the [docs](https://reactrouter.com), especially the [feature overview](https://reactrouter.com/start/overview) and the [tutorial](https://reactrouter.com/start/tutorial).
|
|
686
696
|
|
|
687
|
-
[
|
|
688
|
-
[rr-feature-overview]: https://reactrouter.com/start/overview
|
|
689
|
-
[rr-tutorial]: https://reactrouter.com/start/tutorial
|
|
690
|
-
[remix-router-readme]: https://github.com/remix-run/react-router/blob/main/packages/router/README.md
|
|
697
|
+
For an overview of the features provided by `@remix-run/router`, please check out the [`README`](./README.md).
|
package/dist/router.cjs.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
|
*
|
|
@@ -3275,7 +3275,8 @@ function createStaticHandler(routes, opts) {
|
|
|
3275
3275
|
}
|
|
3276
3276
|
// Config driven behavior flags
|
|
3277
3277
|
let future = _extends({
|
|
3278
|
-
v7_relativeSplatPath: false
|
|
3278
|
+
v7_relativeSplatPath: false,
|
|
3279
|
+
v7_throwAbortReason: false
|
|
3279
3280
|
}, opts ? opts.future : null);
|
|
3280
3281
|
let dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties, undefined, manifest);
|
|
3281
3282
|
|
|
@@ -3498,8 +3499,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3498
3499
|
requestContext
|
|
3499
3500
|
});
|
|
3500
3501
|
if (request.signal.aborted) {
|
|
3501
|
-
|
|
3502
|
-
throw new Error(method + "() call aborted: " + request.method + " " + request.url);
|
|
3502
|
+
throwStaticHandlerAbortedError(request, isRouteRequest, future);
|
|
3503
3503
|
}
|
|
3504
3504
|
}
|
|
3505
3505
|
if (isRedirectResult(result)) {
|
|
@@ -3617,8 +3617,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3617
3617
|
requestContext
|
|
3618
3618
|
}))]);
|
|
3619
3619
|
if (request.signal.aborted) {
|
|
3620
|
-
|
|
3621
|
-
throw new Error(method + "() call aborted: " + request.method + " " + request.url);
|
|
3620
|
+
throwStaticHandlerAbortedError(request, isRouteRequest, future);
|
|
3622
3621
|
}
|
|
3623
3622
|
|
|
3624
3623
|
// Process and commit output from loaders
|
|
@@ -3656,13 +3655,20 @@ function createStaticHandler(routes, opts) {
|
|
|
3656
3655
|
*/
|
|
3657
3656
|
function getStaticContextFromError(routes, context, error) {
|
|
3658
3657
|
let newContext = _extends({}, context, {
|
|
3659
|
-
statusCode: 500,
|
|
3658
|
+
statusCode: isRouteErrorResponse(error) ? error.status : 500,
|
|
3660
3659
|
errors: {
|
|
3661
3660
|
[context._deepestRenderedBoundaryId || routes[0].id]: error
|
|
3662
3661
|
}
|
|
3663
3662
|
});
|
|
3664
3663
|
return newContext;
|
|
3665
3664
|
}
|
|
3665
|
+
function throwStaticHandlerAbortedError(request, isRouteRequest, future) {
|
|
3666
|
+
if (future.v7_throwAbortReason && request.signal.reason !== undefined) {
|
|
3667
|
+
throw request.signal.reason;
|
|
3668
|
+
}
|
|
3669
|
+
let method = isRouteRequest ? "queryRoute" : "query";
|
|
3670
|
+
throw new Error(method + "() call aborted: " + request.method + " " + request.url);
|
|
3671
|
+
}
|
|
3666
3672
|
function isSubmissionNavigation(opts) {
|
|
3667
3673
|
return opts != null && ("formData" in opts && opts.formData != null || "body" in opts && opts.body !== undefined);
|
|
3668
3674
|
}
|