@remix-run/router 1.21.1 → 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 +8 -0
- 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/dist/router.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
|
*
|
|
@@ -1398,6 +1398,7 @@ function createRouter(init) {
|
|
|
1398
1398
|
// SSR did the initial scroll restoration.
|
|
1399
1399
|
let initialScrollRestored = init.hydrationData != null;
|
|
1400
1400
|
let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);
|
|
1401
|
+
let initialMatchesIsFOW = false;
|
|
1401
1402
|
let initialErrors = null;
|
|
1402
1403
|
if (initialMatches == null && !patchRoutesOnNavigationImpl) {
|
|
1403
1404
|
// If we do not match a user-provided-route, fall back to the root
|
|
@@ -1436,6 +1437,7 @@ function createRouter(init) {
|
|
|
1436
1437
|
if (future.v7_partialHydration) {
|
|
1437
1438
|
let fogOfWar = checkFogOfWar(null, dataRoutes, init.history.location.pathname);
|
|
1438
1439
|
if (fogOfWar.active && fogOfWar.matches) {
|
|
1440
|
+
initialMatchesIsFOW = true;
|
|
1439
1441
|
initialMatches = fogOfWar.matches;
|
|
1440
1442
|
}
|
|
1441
1443
|
}
|
|
@@ -1917,7 +1919,9 @@ function createRouter(init) {
|
|
|
1917
1919
|
pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true;
|
|
1918
1920
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
1919
1921
|
let loadingNavigation = opts && opts.overrideNavigation;
|
|
1920
|
-
let matches =
|
|
1922
|
+
let matches = opts != null && opts.initialHydration && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ?
|
|
1923
|
+
// `matchRoutes()` has already been called if we're in here via `router.initialize()`
|
|
1924
|
+
state.matches : matchRoutes(routesToUse, location, basename);
|
|
1921
1925
|
let flushSync = (opts && opts.flushSync) === true;
|
|
1922
1926
|
let fogOfWar = checkFogOfWar(matches, routesToUse, location.pathname);
|
|
1923
1927
|
if (fogOfWar.active && fogOfWar.matches) {
|
|
@@ -4350,17 +4354,23 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4350
4354
|
}
|
|
4351
4355
|
if (type === ResultType.error) {
|
|
4352
4356
|
if (isDataWithResponseInit(result)) {
|
|
4353
|
-
var _result$
|
|
4357
|
+
var _result$init3, _result$init4;
|
|
4354
4358
|
if (result.data instanceof Error) {
|
|
4355
|
-
var _result$init;
|
|
4359
|
+
var _result$init, _result$init2;
|
|
4356
4360
|
return {
|
|
4357
4361
|
type: ResultType.error,
|
|
4358
4362
|
error: result.data,
|
|
4359
|
-
statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status
|
|
4363
|
+
statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status,
|
|
4364
|
+
headers: (_result$init2 = result.init) != null && _result$init2.headers ? new Headers(result.init.headers) : undefined
|
|
4360
4365
|
};
|
|
4361
4366
|
}
|
|
4362
4367
|
// Convert thrown data() to ErrorResponse instances
|
|
4363
|
-
|
|
4368
|
+
return {
|
|
4369
|
+
type: ResultType.error,
|
|
4370
|
+
error: new ErrorResponseImpl(((_result$init3 = result.init) == null ? void 0 : _result$init3.status) || 500, undefined, result.data),
|
|
4371
|
+
statusCode: isRouteErrorResponse(result) ? result.status : undefined,
|
|
4372
|
+
headers: (_result$init4 = result.init) != null && _result$init4.headers ? new Headers(result.init.headers) : undefined
|
|
4373
|
+
};
|
|
4364
4374
|
}
|
|
4365
4375
|
return {
|
|
4366
4376
|
type: ResultType.error,
|
|
@@ -4369,21 +4379,21 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4369
4379
|
};
|
|
4370
4380
|
}
|
|
4371
4381
|
if (isDeferredData(result)) {
|
|
4372
|
-
var _result$
|
|
4382
|
+
var _result$init5, _result$init6;
|
|
4373
4383
|
return {
|
|
4374
4384
|
type: ResultType.deferred,
|
|
4375
4385
|
deferredData: result,
|
|
4376
|
-
statusCode: (_result$
|
|
4377
|
-
headers: ((_result$
|
|
4386
|
+
statusCode: (_result$init5 = result.init) == null ? void 0 : _result$init5.status,
|
|
4387
|
+
headers: ((_result$init6 = result.init) == null ? void 0 : _result$init6.headers) && new Headers(result.init.headers)
|
|
4378
4388
|
};
|
|
4379
4389
|
}
|
|
4380
4390
|
if (isDataWithResponseInit(result)) {
|
|
4381
|
-
var _result$
|
|
4391
|
+
var _result$init7, _result$init8;
|
|
4382
4392
|
return {
|
|
4383
4393
|
type: ResultType.data,
|
|
4384
4394
|
data: result.data,
|
|
4385
|
-
statusCode: (_result$
|
|
4386
|
-
headers: (_result$
|
|
4395
|
+
statusCode: (_result$init7 = result.init) == null ? void 0 : _result$init7.status,
|
|
4396
|
+
headers: (_result$init8 = result.init) != null && _result$init8.headers ? new Headers(result.init.headers) : undefined
|
|
4387
4397
|
};
|
|
4388
4398
|
}
|
|
4389
4399
|
return {
|