@remix-run/router 1.15.2 → 1.15.3-pre.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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # `@remix-run/router`
2
2
 
3
+ ## 1.15.3-pre.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix a `future.v7_partialHydration` bug that would re-run loaders below the boundary on hydration if SSR loader errors bubbled to a parent boundary ([#11324](https://github.com/remix-run/react-router/pull/11324))
8
+ - Fix a `future.v7_partialHydration` bug that would consider the router uninitialized if a route did not have a loader ([#11325](https://github.com/remix-run/react-router/pull/11325))
9
+
3
10
  ## 1.15.2
4
11
 
5
12
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/router v1.15.2
2
+ * @remix-run/router v1.15.3-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1727,7 +1727,22 @@ function createRouter(init) {
1727
1727
  // were marked for explicit hydration
1728
1728
  let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;
1729
1729
  let errors = init.hydrationData ? init.hydrationData.errors : null;
1730
- initialized = initialMatches.every(m => m.route.loader && m.route.loader.hydrate !== true && (loaderData && loaderData[m.route.id] !== undefined || errors && errors[m.route.id] !== undefined));
1730
+ let isRouteInitialized = m => {
1731
+ // No loader, nothing to initialize
1732
+ if (!m.route.loader) return true;
1733
+ // Explicitly opting-in to running on hydration
1734
+ if (m.route.loader.hydrate === true) return false;
1735
+ // Otherwise, initialized if hydrated with data or an error
1736
+ return loaderData && loaderData[m.route.id] !== undefined || errors && errors[m.route.id] !== undefined;
1737
+ };
1738
+
1739
+ // If errors exist, don't consider routes below the boundary
1740
+ if (errors) {
1741
+ let idx = initialMatches.findIndex(m => errors[m.route.id] !== undefined);
1742
+ initialized = initialMatches.slice(0, idx + 1).every(isRouteInitialized);
1743
+ } else {
1744
+ initialized = initialMatches.every(isRouteInitialized);
1745
+ }
1731
1746
  } else {
1732
1747
  // Without partial hydration - we're initialized if we were provided any
1733
1748
  // hydrationData - which is expected to be complete