@remix-run/router 1.14.0-pre.0 → 1.14.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 +4 -4
- package/dist/router.cjs.js +24 -14
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.js +24 -13
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +24 -14
- 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 +27 -16
package/dist/router.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v1.14.0
|
|
2
|
+
* @remix-run/router v1.14.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -1380,17 +1380,28 @@ function createRouter(init) {
|
|
|
1380
1380
|
[route.id]: error
|
|
1381
1381
|
};
|
|
1382
1382
|
}
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1383
|
+
let initialized;
|
|
1384
|
+
let hasLazyRoutes = initialMatches.some(m => m.route.lazy);
|
|
1385
|
+
let hasLoaders = initialMatches.some(m => m.route.loader);
|
|
1386
|
+
if (hasLazyRoutes) {
|
|
1387
|
+
// All initialMatches need to be loaded before we're ready. If we have lazy
|
|
1388
|
+
// functions around still then we'll need to run them in initialize()
|
|
1389
|
+
initialized = false;
|
|
1390
|
+
} else if (!hasLoaders) {
|
|
1391
|
+
// If we've got no loaders to run, then we're good to go
|
|
1392
|
+
initialized = true;
|
|
1393
|
+
} else if (future.v7_partialHydration) {
|
|
1394
|
+
// If partial hydration is enabled, we're initialized so long as we were
|
|
1395
|
+
// provided with hydrationData for every route with a loader, and no loaders
|
|
1396
|
+
// were marked for explicit hydration
|
|
1397
|
+
let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;
|
|
1398
|
+
let errors = init.hydrationData ? init.hydrationData.errors : null;
|
|
1399
|
+
initialized = initialMatches.every(m => m.route.loader && m.route.loader.hydrate !== true && (loaderData && loaderData[m.route.id] !== undefined || errors && errors[m.route.id] !== undefined));
|
|
1400
|
+
} else {
|
|
1401
|
+
// Without partial hydration - we're initialized if we were provided any
|
|
1402
|
+
// hydrationData - which is expected to be complete
|
|
1403
|
+
initialized = init.hydrationData != null;
|
|
1404
|
+
}
|
|
1394
1405
|
let router;
|
|
1395
1406
|
let state = {
|
|
1396
1407
|
historyAction: init.history.action,
|
|
@@ -1533,7 +1544,7 @@ function createRouter(init) {
|
|
|
1533
1544
|
// in the normal navigation flow. For SSR it's expected that lazy modules are
|
|
1534
1545
|
// resolved prior to router creation since we can't go into a fallbackElement
|
|
1535
1546
|
// UI for SSR'd apps
|
|
1536
|
-
if (!state.initialized
|
|
1547
|
+
if (!state.initialized) {
|
|
1537
1548
|
startNavigation(Action.Pop, state.location, {
|
|
1538
1549
|
initialHydration: true
|
|
1539
1550
|
});
|