@remix-run/router 1.20.0-pre.0 → 1.20.0-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 +6 -0
- package/dist/router.cjs.js +8 -32
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.js +8 -32
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +8 -32
- 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 +10 -37
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# `@remix-run/router`
|
|
2
2
|
|
|
3
|
+
## 1.20.0-pre.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Expose errors thrown from `patchRoutesOnNavigation` directly to `useRouteError` instead of wrapping them in a 400 `ErrorResponse` instance ([#12111](https://github.com/remix-run/react-router/pull/12111))
|
|
8
|
+
|
|
3
9
|
## 1.20.0-pre.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/router.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.20.0-pre.
|
|
2
|
+
* @remix-run/router v1.20.0-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2433,15 +2433,12 @@ function createRouter(init) {
|
|
|
2433
2433
|
shortCircuited: true
|
|
2434
2434
|
};
|
|
2435
2435
|
} else if (discoverResult.type === "error") {
|
|
2436
|
-
let
|
|
2437
|
-
boundaryId,
|
|
2438
|
-
error
|
|
2439
|
-
} = handleDiscoverRouteError(location.pathname, discoverResult);
|
|
2436
|
+
let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;
|
|
2440
2437
|
return {
|
|
2441
2438
|
matches: discoverResult.partialMatches,
|
|
2442
2439
|
pendingActionResult: [boundaryId, {
|
|
2443
2440
|
type: ResultType.error,
|
|
2444
|
-
error
|
|
2441
|
+
error: discoverResult.error
|
|
2445
2442
|
}]
|
|
2446
2443
|
};
|
|
2447
2444
|
} else if (!discoverResult.matches) {
|
|
@@ -2571,15 +2568,12 @@ function createRouter(init) {
|
|
|
2571
2568
|
shortCircuited: true
|
|
2572
2569
|
};
|
|
2573
2570
|
} else if (discoverResult.type === "error") {
|
|
2574
|
-
let
|
|
2575
|
-
boundaryId,
|
|
2576
|
-
error
|
|
2577
|
-
} = handleDiscoverRouteError(location.pathname, discoverResult);
|
|
2571
|
+
let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;
|
|
2578
2572
|
return {
|
|
2579
2573
|
matches: discoverResult.partialMatches,
|
|
2580
2574
|
loaderData: {},
|
|
2581
2575
|
errors: {
|
|
2582
|
-
[boundaryId]: error
|
|
2576
|
+
[boundaryId]: discoverResult.error
|
|
2583
2577
|
}
|
|
2584
2578
|
};
|
|
2585
2579
|
} else if (!discoverResult.matches) {
|
|
@@ -2843,10 +2837,7 @@ function createRouter(init) {
|
|
|
2843
2837
|
if (discoverResult.type === "aborted") {
|
|
2844
2838
|
return;
|
|
2845
2839
|
} else if (discoverResult.type === "error") {
|
|
2846
|
-
|
|
2847
|
-
error
|
|
2848
|
-
} = handleDiscoverRouteError(path, discoverResult);
|
|
2849
|
-
setFetcherError(key, routeId, error, {
|
|
2840
|
+
setFetcherError(key, routeId, discoverResult.error, {
|
|
2850
2841
|
flushSync
|
|
2851
2842
|
});
|
|
2852
2843
|
return;
|
|
@@ -3032,10 +3023,7 @@ function createRouter(init) {
|
|
|
3032
3023
|
if (discoverResult.type === "aborted") {
|
|
3033
3024
|
return;
|
|
3034
3025
|
} else if (discoverResult.type === "error") {
|
|
3035
|
-
|
|
3036
|
-
error
|
|
3037
|
-
} = handleDiscoverRouteError(path, discoverResult);
|
|
3038
|
-
setFetcherError(key, routeId, error, {
|
|
3026
|
+
setFetcherError(key, routeId, discoverResult.error, {
|
|
3039
3027
|
flushSync
|
|
3040
3028
|
});
|
|
3041
3029
|
return;
|
|
@@ -3480,16 +3468,6 @@ function createRouter(init) {
|
|
|
3480
3468
|
error
|
|
3481
3469
|
};
|
|
3482
3470
|
}
|
|
3483
|
-
function handleDiscoverRouteError(pathname, discoverResult) {
|
|
3484
|
-
return {
|
|
3485
|
-
boundaryId: findNearestBoundary(discoverResult.partialMatches).route.id,
|
|
3486
|
-
error: getInternalRouterError(400, {
|
|
3487
|
-
type: "route-discovery",
|
|
3488
|
-
pathname,
|
|
3489
|
-
message: discoverResult.error != null && "message" in discoverResult.error ? discoverResult.error : String(discoverResult.error)
|
|
3490
|
-
})
|
|
3491
|
-
};
|
|
3492
|
-
}
|
|
3493
3471
|
function cancelActiveDeferreds(predicate) {
|
|
3494
3472
|
let cancelledRouteIds = [];
|
|
3495
3473
|
activeDeferreds.forEach((dfd, routeId) => {
|
|
@@ -5190,9 +5168,7 @@ function getInternalRouterError(status, _temp5) {
|
|
|
5190
5168
|
let errorMessage = "Unknown @remix-run/router error";
|
|
5191
5169
|
if (status === 400) {
|
|
5192
5170
|
statusText = "Bad Request";
|
|
5193
|
-
if (
|
|
5194
|
-
errorMessage = "Unable to match URL \"" + pathname + "\" - the `patchRoutesOnNavigation()` " + ("function threw the following error:\n" + message);
|
|
5195
|
-
} else if (method && pathname && routeId) {
|
|
5171
|
+
if (method && pathname && routeId) {
|
|
5196
5172
|
errorMessage = "You made a " + method + " request to \"" + pathname + "\" but " + ("did not provide a `loader` for route \"" + routeId + "\", ") + "so there is no way to handle the request.";
|
|
5197
5173
|
} else if (type === "defer-action") {
|
|
5198
5174
|
errorMessage = "defer() is not supported in actions";
|