@remix-run/router 0.0.0-experimental-432fcb2e → 0.0.0-experimental-71108452
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/dist/router.cjs.js +21 -2
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.js +20 -2
- package/dist/router.js.map +1 -1
- package/dist/router.umd.js +21 -2
- 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 +28 -8
package/dist/router.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/router v0.0.0-experimental-
|
|
2
|
+
* @remix-run/router v0.0.0-experimental-71108452
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -1728,7 +1728,26 @@ function createRouter(init) {
|
|
|
1728
1728
|
// were marked for explicit hydration
|
|
1729
1729
|
let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;
|
|
1730
1730
|
let errors = init.hydrationData ? init.hydrationData.errors : null;
|
|
1731
|
-
|
|
1731
|
+
let isRouteInitialized = m => {
|
|
1732
|
+
// No loader, nothing to initialize
|
|
1733
|
+
if (!m.route.loader) {
|
|
1734
|
+
return true;
|
|
1735
|
+
}
|
|
1736
|
+
// Explicitly opting-in to running on hydration
|
|
1737
|
+
if (typeof m.route.loader === "function" && m.route.loader.hydrate === true) {
|
|
1738
|
+
return false;
|
|
1739
|
+
}
|
|
1740
|
+
// Otherwise, initialized if hydrated with data or an error
|
|
1741
|
+
return loaderData && loaderData[m.route.id] !== undefined || errors && errors[m.route.id] !== undefined;
|
|
1742
|
+
};
|
|
1743
|
+
|
|
1744
|
+
// If errors exist, don't consider routes below the boundary
|
|
1745
|
+
if (errors) {
|
|
1746
|
+
let idx = initialMatches.findIndex(m => errors[m.route.id] !== undefined);
|
|
1747
|
+
initialized = initialMatches.slice(0, idx + 1).every(isRouteInitialized);
|
|
1748
|
+
} else {
|
|
1749
|
+
initialized = initialMatches.every(isRouteInitialized);
|
|
1750
|
+
}
|
|
1732
1751
|
} else {
|
|
1733
1752
|
// Without partial hydration - we're initialized if we were provided any
|
|
1734
1753
|
// hydrationData - which is expected to be complete
|