@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.
@@ -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
  *
@@ -2442,7 +2442,7 @@
2442
2442
  // preserving any new action data or existing action data (in the case of
2443
2443
  // a revalidation interrupting an actionReload)
2444
2444
  // If we have partialHydration enabled, then don't update the state for the
2445
- // initial data load since iot's not a "navigation"
2445
+ // initial data load since it's not a "navigation"
2446
2446
  if (!isUninterruptedRevalidation && (!future.v7_partialHydration || !initialHydration)) {
2447
2447
  revalidatingFetchers.forEach(rf => {
2448
2448
  let fetcher = state.fetchers.get(rf.key);
@@ -2533,6 +2533,19 @@
2533
2533
  }
2534
2534
  });
2535
2535
  });
2536
+
2537
+ // During partial hydration, preserve SSR errors for routes that don't re-run
2538
+ if (future.v7_partialHydration && initialHydration && state.errors) {
2539
+ Object.entries(state.errors).filter(_ref2 => {
2540
+ let [id] = _ref2;
2541
+ return !matchesToLoad.some(m => m.route.id === id);
2542
+ }).forEach(_ref3 => {
2543
+ let [routeId, error] = _ref3;
2544
+ errors = Object.assign(errors || {}, {
2545
+ [routeId]: error
2546
+ });
2547
+ });
2548
+ }
2536
2549
  let updatedFetchers = markFetchRedirectsDone();
2537
2550
  let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);
2538
2551
  let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0;
@@ -3103,12 +3116,12 @@
3103
3116
  blockers
3104
3117
  });
3105
3118
  }
3106
- function shouldBlockNavigation(_ref2) {
3119
+ function shouldBlockNavigation(_ref4) {
3107
3120
  let {
3108
3121
  currentLocation,
3109
3122
  nextLocation,
3110
3123
  historyAction
3111
- } = _ref2;
3124
+ } = _ref4;
3112
3125
  if (blockerFunctions.size === 0) {
3113
3126
  return;
3114
3127
  }
@@ -3751,8 +3764,8 @@
3751
3764
  }
3752
3765
  let text = typeof opts.body === "string" ? opts.body : opts.body instanceof FormData || opts.body instanceof URLSearchParams ?
3753
3766
  // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data
3754
- Array.from(opts.body.entries()).reduce((acc, _ref3) => {
3755
- let [name, value] = _ref3;
3767
+ Array.from(opts.body.entries()).reduce((acc, _ref5) => {
3768
+ let [name, value] = _ref5;
3756
3769
  return "" + acc + name + "=" + value + "\n";
3757
3770
  }, "") : String(opts.body);
3758
3771
  return {