@remix-run/router 1.15.1 → 1.15.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix-run/router",
3
- "version": "1.15.1",
3
+ "version": "1.15.2",
4
4
  "description": "Nested/Data-driven/Framework-agnostic Routing",
5
5
  "keywords": [
6
6
  "remix",
package/router.ts CHANGED
@@ -1718,7 +1718,7 @@ export function createRouter(init: RouterInit): Router {
1718
1718
  // preserving any new action data or existing action data (in the case of
1719
1719
  // a revalidation interrupting an actionReload)
1720
1720
  // If we have partialHydration enabled, then don't update the state for the
1721
- // initial data load since iot's not a "navigation"
1721
+ // initial data load since it's not a "navigation"
1722
1722
  if (
1723
1723
  !isUninterruptedRevalidation &&
1724
1724
  (!future.v7_partialHydration || !initialHydration)
@@ -1835,6 +1835,15 @@ export function createRouter(init: RouterInit): Router {
1835
1835
  });
1836
1836
  });
1837
1837
 
1838
+ // During partial hydration, preserve SSR errors for routes that don't re-run
1839
+ if (future.v7_partialHydration && initialHydration && state.errors) {
1840
+ Object.entries(state.errors)
1841
+ .filter(([id]) => !matchesToLoad.some((m) => m.route.id === id))
1842
+ .forEach(([routeId, error]) => {
1843
+ errors = Object.assign(errors || {}, { [routeId]: error });
1844
+ });
1845
+ }
1846
+
1838
1847
  let updatedFetchers = markFetchRedirectsDone();
1839
1848
  let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);
1840
1849
  let shouldUpdateFetchers =