@remix-run/router 1.20.0-pre.0 → 1.20.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 +7 -8
- 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,30 +1,29 @@
|
|
|
1
1
|
# `@remix-run/router`
|
|
2
2
|
|
|
3
|
-
## 1.20.0
|
|
3
|
+
## 1.20.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
7
|
- Stabilize `unstable_patchRoutesOnNavigation` ([#11973](https://github.com/remix-run/react-router/pull/11973))
|
|
8
|
+
- Add new `PatchRoutesOnNavigationFunctionArgs` type for convenience ([#11967](https://github.com/remix-run/react-router/pull/11967))
|
|
8
9
|
- Stabilize `unstable_dataStrategy` ([#11974](https://github.com/remix-run/react-router/pull/11974))
|
|
9
10
|
- Stabilize the `unstable_flushSync` option for navigations and fetchers ([#11989](https://github.com/remix-run/react-router/pull/11989))
|
|
10
11
|
- Stabilize the `unstable_viewTransition` option for navigations and the corresponding `unstable_useViewTransitionState` hook ([#11989](https://github.com/remix-run/react-router/pull/11989))
|
|
11
12
|
|
|
12
13
|
### Patch Changes
|
|
13
14
|
|
|
14
|
-
-
|
|
15
|
-
|
|
15
|
+
- Fix bug when submitting to the current contextual route (parent route with an index child) when an `?index` param already exists from a prior submission ([#12003](https://github.com/remix-run/react-router/pull/12003))
|
|
16
|
+
- Fix `useFormAction` bug - when removing `?index` param it would not keep other non-Remix `index` params ([#12003](https://github.com/remix-run/react-router/pull/12003))
|
|
16
17
|
- Fix bug with fetchers not persisting `preventScrollReset` through redirects during concurrent fetches ([#11999](https://github.com/remix-run/react-router/pull/11999))
|
|
17
18
|
- Remove internal cache to fix issues with interrupted `patchRoutesOnNavigation` calls ([#12055](https://github.com/remix-run/react-router/pull/12055))
|
|
18
|
-
|
|
19
19
|
- We used to cache in-progress calls to `patchRoutesOnNavigation` internally so that multiple navigations with the same start/end would only execute the function once and use the same promise
|
|
20
20
|
- However, this approach was at odds with `patch` short circuiting if a navigation was interrupted (and the `request.signal` aborted) since the first invocation's `patch` would no-op
|
|
21
21
|
- This cache also made some assumptions as to what a valid cache key might be - and is oblivious to any other application-state changes that may have occurred
|
|
22
22
|
- So, the cache has been removed because in _most_ cases, repeated calls to something like `import()` for async routes will already be cached automatically - and if not it's easy enough for users to implement this cache in userland
|
|
23
|
-
|
|
24
23
|
- Avoid unnecessary `console.error` on fetcher abort due to back-to-back revalidation calls ([#12050](https://github.com/remix-run/react-router/pull/12050))
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
- Fix bugs with partialHydration when hydrating with errors ([#12070](https://github.com/remix-run/react-router/pull/12070))
|
|
24
|
+
- 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))
|
|
25
|
+
- Fix types for `RouteObject` within `PatchRoutesOnNavigationFunction`'s `patch` method so it doesn't expect agnostic route objects passed to `patch` ([#11967](https://github.com/remix-run/react-router/pull/11967))
|
|
26
|
+
- Fix bugs with `partialHydration` when hydrating with errors ([#12070](https://github.com/remix-run/react-router/pull/12070))
|
|
28
27
|
- Remove internal `discoveredRoutes` FIFO queue from `unstable_patchRoutesOnNavigation` ([#11977](https://github.com/remix-run/react-router/pull/11977))
|
|
29
28
|
|
|
30
29
|
## 1.19.2
|
package/dist/router.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.20.0
|
|
2
|
+
* @remix-run/router v1.20.0
|
|
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";
|