@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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # `@remix-run/router`
2
2
 
3
+ ## 1.15.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Preserve hydrated errors during partial hydration runs ([#11305](https://github.com/remix-run/react-router/pull/11305))
8
+
3
9
  ## 1.15.1
4
10
 
5
11
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/router v1.15.1
2
+ * @remix-run/router v1.15.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -2440,7 +2440,7 @@ function createRouter(init) {
2440
2440
  // preserving any new action data or existing action data (in the case of
2441
2441
  // a revalidation interrupting an actionReload)
2442
2442
  // If we have partialHydration enabled, then don't update the state for the
2443
- // initial data load since iot's not a "navigation"
2443
+ // initial data load since it's not a "navigation"
2444
2444
  if (!isUninterruptedRevalidation && (!future.v7_partialHydration || !initialHydration)) {
2445
2445
  revalidatingFetchers.forEach(rf => {
2446
2446
  let fetcher = state.fetchers.get(rf.key);
@@ -2531,6 +2531,19 @@ function createRouter(init) {
2531
2531
  }
2532
2532
  });
2533
2533
  });
2534
+
2535
+ // During partial hydration, preserve SSR errors for routes that don't re-run
2536
+ if (future.v7_partialHydration && initialHydration && state.errors) {
2537
+ Object.entries(state.errors).filter(_ref2 => {
2538
+ let [id] = _ref2;
2539
+ return !matchesToLoad.some(m => m.route.id === id);
2540
+ }).forEach(_ref3 => {
2541
+ let [routeId, error] = _ref3;
2542
+ errors = Object.assign(errors || {}, {
2543
+ [routeId]: error
2544
+ });
2545
+ });
2546
+ }
2534
2547
  let updatedFetchers = markFetchRedirectsDone();
2535
2548
  let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);
2536
2549
  let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0;
@@ -3101,12 +3114,12 @@ function createRouter(init) {
3101
3114
  blockers
3102
3115
  });
3103
3116
  }
3104
- function shouldBlockNavigation(_ref2) {
3117
+ function shouldBlockNavigation(_ref4) {
3105
3118
  let {
3106
3119
  currentLocation,
3107
3120
  nextLocation,
3108
3121
  historyAction
3109
- } = _ref2;
3122
+ } = _ref4;
3110
3123
  if (blockerFunctions.size === 0) {
3111
3124
  return;
3112
3125
  }
@@ -3749,8 +3762,8 @@ function normalizeNavigateOptions(normalizeFormMethod, isFetcher, path, opts) {
3749
3762
  }
3750
3763
  let text = typeof opts.body === "string" ? opts.body : opts.body instanceof FormData || opts.body instanceof URLSearchParams ?
3751
3764
  // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data
3752
- Array.from(opts.body.entries()).reduce((acc, _ref3) => {
3753
- let [name, value] = _ref3;
3765
+ Array.from(opts.body.entries()).reduce((acc, _ref5) => {
3766
+ let [name, value] = _ref5;
3754
3767
  return "" + acc + name + "=" + value + "\n";
3755
3768
  }, "") : String(opts.body);
3756
3769
  return {