@remix-run/router 1.15.2 → 1.15.3

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/router v1.15.2
2
+ * @remix-run/router v1.15.3
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1378,7 +1378,21 @@ function createRouter(init) {
1378
1378
  // were marked for explicit hydration
1379
1379
  let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;
1380
1380
  let errors = init.hydrationData ? init.hydrationData.errors : null;
1381
- initialized = initialMatches.every(m => m.route.loader && m.route.loader.hydrate !== true && (loaderData && loaderData[m.route.id] !== undefined || errors && errors[m.route.id] !== undefined));
1381
+ let isRouteInitialized = m => {
1382
+ // No loader, nothing to initialize
1383
+ if (!m.route.loader) return true;
1384
+ // Explicitly opting-in to running on hydration
1385
+ if (m.route.loader.hydrate === true) return false;
1386
+ // Otherwise, initialized if hydrated with data or an error
1387
+ return loaderData && loaderData[m.route.id] !== undefined || errors && errors[m.route.id] !== undefined;
1388
+ };
1389
+ // If errors exist, don't consider routes below the boundary
1390
+ if (errors) {
1391
+ let idx = initialMatches.findIndex(m => errors[m.route.id] !== undefined);
1392
+ initialized = initialMatches.slice(0, idx + 1).every(isRouteInitialized);
1393
+ } else {
1394
+ initialized = initialMatches.every(isRouteInitialized);
1395
+ }
1382
1396
  } else {
1383
1397
  // Without partial hydration - we're initialized if we were provided any
1384
1398
  // hydrationData - which is expected to be complete