@remix-run/router 1.21.1-pre.0 → 1.21.2-pre-v6.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 +9 -1
- package/dist/router.cjs.js +22 -12
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.js +22 -12
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +22 -12
- 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 +25 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# `@remix-run/router`
|
|
2
2
|
|
|
3
|
-
## 1.21.
|
|
3
|
+
## 1.21.2-pre-v6.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Do not log v7 deprecation warnings in production builds ([#12794](https://github.com/remix-run/react-router/pull/12794))
|
|
8
|
+
- Properly bubble headers when throwing a `data()` result ([#12845](https://github.com/remix-run/react-router/pull/12845))
|
|
9
|
+
- Optimize route matching by skipping redundant `matchRoutes` calls when possible ([#12169](https://github.com/remix-run/react-router/pull/12169))
|
|
10
|
+
|
|
11
|
+
## 1.21.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
6
14
|
|
package/dist/router.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.21.
|
|
2
|
+
* @remix-run/router v1.21.2-pre-v6.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -1748,6 +1748,7 @@ function createRouter(init) {
|
|
|
1748
1748
|
// SSR did the initial scroll restoration.
|
|
1749
1749
|
let initialScrollRestored = init.hydrationData != null;
|
|
1750
1750
|
let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);
|
|
1751
|
+
let initialMatchesIsFOW = false;
|
|
1751
1752
|
let initialErrors = null;
|
|
1752
1753
|
if (initialMatches == null && !patchRoutesOnNavigationImpl) {
|
|
1753
1754
|
// If we do not match a user-provided-route, fall back to the root
|
|
@@ -1788,6 +1789,7 @@ function createRouter(init) {
|
|
|
1788
1789
|
if (future.v7_partialHydration) {
|
|
1789
1790
|
let fogOfWar = checkFogOfWar(null, dataRoutes, init.history.location.pathname);
|
|
1790
1791
|
if (fogOfWar.active && fogOfWar.matches) {
|
|
1792
|
+
initialMatchesIsFOW = true;
|
|
1791
1793
|
initialMatches = fogOfWar.matches;
|
|
1792
1794
|
}
|
|
1793
1795
|
}
|
|
@@ -2316,7 +2318,9 @@ function createRouter(init) {
|
|
|
2316
2318
|
pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true;
|
|
2317
2319
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
2318
2320
|
let loadingNavigation = opts && opts.overrideNavigation;
|
|
2319
|
-
let matches =
|
|
2321
|
+
let matches = opts != null && opts.initialHydration && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ?
|
|
2322
|
+
// `matchRoutes()` has already been called if we're in here via `router.initialize()`
|
|
2323
|
+
state.matches : matchRoutes(routesToUse, location, basename);
|
|
2320
2324
|
let flushSync = (opts && opts.flushSync) === true;
|
|
2321
2325
|
let fogOfWar = checkFogOfWar(matches, routesToUse, location.pathname);
|
|
2322
2326
|
if (fogOfWar.active && fogOfWar.matches) {
|
|
@@ -4868,18 +4872,24 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4868
4872
|
}
|
|
4869
4873
|
if (type === ResultType.error) {
|
|
4870
4874
|
if (isDataWithResponseInit(result)) {
|
|
4871
|
-
var _result$
|
|
4875
|
+
var _result$init3, _result$init4;
|
|
4872
4876
|
if (result.data instanceof Error) {
|
|
4873
|
-
var _result$init;
|
|
4877
|
+
var _result$init, _result$init2;
|
|
4874
4878
|
return {
|
|
4875
4879
|
type: ResultType.error,
|
|
4876
4880
|
error: result.data,
|
|
4877
|
-
statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status
|
|
4881
|
+
statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status,
|
|
4882
|
+
headers: (_result$init2 = result.init) != null && _result$init2.headers ? new Headers(result.init.headers) : undefined
|
|
4878
4883
|
};
|
|
4879
4884
|
}
|
|
4880
4885
|
|
|
4881
4886
|
// Convert thrown data() to ErrorResponse instances
|
|
4882
|
-
|
|
4887
|
+
return {
|
|
4888
|
+
type: ResultType.error,
|
|
4889
|
+
error: new ErrorResponseImpl(((_result$init3 = result.init) == null ? void 0 : _result$init3.status) || 500, undefined, result.data),
|
|
4890
|
+
statusCode: isRouteErrorResponse(result) ? result.status : undefined,
|
|
4891
|
+
headers: (_result$init4 = result.init) != null && _result$init4.headers ? new Headers(result.init.headers) : undefined
|
|
4892
|
+
};
|
|
4883
4893
|
}
|
|
4884
4894
|
return {
|
|
4885
4895
|
type: ResultType.error,
|
|
@@ -4888,21 +4898,21 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4888
4898
|
};
|
|
4889
4899
|
}
|
|
4890
4900
|
if (isDeferredData(result)) {
|
|
4891
|
-
var _result$
|
|
4901
|
+
var _result$init5, _result$init6;
|
|
4892
4902
|
return {
|
|
4893
4903
|
type: ResultType.deferred,
|
|
4894
4904
|
deferredData: result,
|
|
4895
|
-
statusCode: (_result$
|
|
4896
|
-
headers: ((_result$
|
|
4905
|
+
statusCode: (_result$init5 = result.init) == null ? void 0 : _result$init5.status,
|
|
4906
|
+
headers: ((_result$init6 = result.init) == null ? void 0 : _result$init6.headers) && new Headers(result.init.headers)
|
|
4897
4907
|
};
|
|
4898
4908
|
}
|
|
4899
4909
|
if (isDataWithResponseInit(result)) {
|
|
4900
|
-
var _result$
|
|
4910
|
+
var _result$init7, _result$init8;
|
|
4901
4911
|
return {
|
|
4902
4912
|
type: ResultType.data,
|
|
4903
4913
|
data: result.data,
|
|
4904
|
-
statusCode: (_result$
|
|
4905
|
-
headers: (_result$
|
|
4914
|
+
statusCode: (_result$init7 = result.init) == null ? void 0 : _result$init7.status,
|
|
4915
|
+
headers: (_result$init8 = result.init) != null && _result$init8.headers ? new Headers(result.init.headers) : undefined
|
|
4906
4916
|
};
|
|
4907
4917
|
}
|
|
4908
4918
|
return {
|