@remix-run/router 1.15.1 → 1.15.2-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/dist/router.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/router v1.15.1
2
+ * @remix-run/router v1.15.2-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -2031,7 +2031,7 @@ function createRouter(init) {
2031
2031
  // preserving any new action data or existing action data (in the case of
2032
2032
  // a revalidation interrupting an actionReload)
2033
2033
  // If we have partialHydration enabled, then don't update the state for the
2034
- // initial data load since iot's not a "navigation"
2034
+ // initial data load since it's not a "navigation"
2035
2035
  if (!isUninterruptedRevalidation && (!future.v7_partialHydration || !initialHydration)) {
2036
2036
  revalidatingFetchers.forEach(rf => {
2037
2037
  let fetcher = state.fetchers.get(rf.key);
@@ -2117,6 +2117,18 @@ function createRouter(init) {
2117
2117
  }
2118
2118
  });
2119
2119
  });
2120
+ // During partial hydration, preserve SSR errors for routes that don't re-run
2121
+ if (future.v7_partialHydration && initialHydration && state.errors) {
2122
+ Object.entries(state.errors).filter(_ref2 => {
2123
+ let [id] = _ref2;
2124
+ return !matchesToLoad.some(m => m.route.id === id);
2125
+ }).forEach(_ref3 => {
2126
+ let [routeId, error] = _ref3;
2127
+ errors = Object.assign(errors || {}, {
2128
+ [routeId]: error
2129
+ });
2130
+ });
2131
+ }
2120
2132
  let updatedFetchers = markFetchRedirectsDone();
2121
2133
  let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);
2122
2134
  let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0;
@@ -2659,12 +2671,12 @@ function createRouter(init) {
2659
2671
  blockers
2660
2672
  });
2661
2673
  }
2662
- function shouldBlockNavigation(_ref2) {
2674
+ function shouldBlockNavigation(_ref4) {
2663
2675
  let {
2664
2676
  currentLocation,
2665
2677
  nextLocation,
2666
2678
  historyAction
2667
- } = _ref2;
2679
+ } = _ref4;
2668
2680
  if (blockerFunctions.size === 0) {
2669
2681
  return;
2670
2682
  }
@@ -3275,8 +3287,8 @@ function normalizeNavigateOptions(normalizeFormMethod, isFetcher, path, opts) {
3275
3287
  }
3276
3288
  let text = typeof opts.body === "string" ? opts.body : opts.body instanceof FormData || opts.body instanceof URLSearchParams ?
3277
3289
  // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data
3278
- Array.from(opts.body.entries()).reduce((acc, _ref3) => {
3279
- let [name, value] = _ref3;
3290
+ Array.from(opts.body.entries()).reduce((acc, _ref5) => {
3291
+ let [name, value] = _ref5;
3280
3292
  return "" + acc + name + "=" + value + "\n";
3281
3293
  }, "") : String(opts.body);
3282
3294
  return {