@remix-run/router 1.6.0 → 1.6.1-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.6.0
2
+ * @remix-run/router v1.6.1-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -3401,7 +3401,7 @@ function normalizeTo(location, matches, basename, prependBasename, to, fromRoute
3401
3401
  } // Resolve the relative path
3402
3402
 
3403
3403
 
3404
- let path = resolveTo(to ? to : ".", getPathContributingMatches(contextualMatches).map(m => m.pathnameBase), location.pathname, relative === "path"); // When `to` is not specified we inherit search/hash from the current
3404
+ let path = resolveTo(to ? to : ".", getPathContributingMatches(contextualMatches).map(m => m.pathnameBase), stripBasename(location.pathname, basename) || location.pathname, relative === "path"); // When `to` is not specified we inherit search/hash from the current
3405
3405
  // location, unlike when to="." and we just inherit the path.
3406
3406
  // See https://github.com/remix-run/remix/issues/927
3407
3407
 
@@ -3535,7 +3535,7 @@ function getMatchesToLoad(history, state, matches, submission, location, isReval
3535
3535
  actionResult,
3536
3536
  defaultShouldRevalidate: // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate
3537
3537
  isRevalidationRequired || // Clicked the same link, resubmitted a GET form
3538
- currentUrl.toString() === nextUrl.toString() || // Search params affect all loaders
3538
+ currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search || // Search params affect all loaders
3539
3539
  currentUrl.search !== nextUrl.search || isNewRouteInstance(currentRouteMatch, nextRouteMatch)
3540
3540
  }));
3541
3541
  }); // Pick fetcher.loads that need to be revalidated
@@ -4150,7 +4150,22 @@ function stripHashFromPath(path) {
4150
4150
  }
4151
4151
 
4152
4152
  function isHashChangeOnly(a, b) {
4153
- return a.pathname === b.pathname && a.search === b.search && a.hash !== b.hash;
4153
+ if (a.pathname !== b.pathname || a.search !== b.search) {
4154
+ return false;
4155
+ }
4156
+
4157
+ if (a.hash === "") {
4158
+ // No hash -> hash
4159
+ return b.hash !== "";
4160
+ } else if (a.hash === b.hash) {
4161
+ // current hash -> same hash
4162
+ return true;
4163
+ } else if (b.hash !== "") {
4164
+ // current hash -> new hash
4165
+ return true;
4166
+ }
4167
+
4168
+ return false;
4154
4169
  }
4155
4170
 
4156
4171
  function isDeferredResult(result) {