@remix-run/router 1.6.0 → 1.6.1

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.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Nested/Data-driven/Framework-agnostic Routing",
5
5
  "keywords": [
6
6
  "remix",
package/router.ts CHANGED
@@ -3094,7 +3094,7 @@ function normalizeTo(
3094
3094
  let path = resolveTo(
3095
3095
  to ? to : ".",
3096
3096
  getPathContributingMatches(contextualMatches).map((m) => m.pathnameBase),
3097
- location.pathname,
3097
+ stripBasename(location.pathname, basename) || location.pathname,
3098
3098
  relative === "path"
3099
3099
  );
3100
3100
 
@@ -3266,7 +3266,8 @@ function getMatchesToLoad(
3266
3266
  // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate
3267
3267
  isRevalidationRequired ||
3268
3268
  // Clicked the same link, resubmitted a GET form
3269
- currentUrl.toString() === nextUrl.toString() ||
3269
+ currentUrl.pathname + currentUrl.search ===
3270
+ nextUrl.pathname + nextUrl.search ||
3270
3271
  // Search params affect all loaders
3271
3272
  currentUrl.search !== nextUrl.search ||
3272
3273
  isNewRouteInstance(currentRouteMatch, nextRouteMatch),
@@ -4003,9 +4004,22 @@ function stripHashFromPath(path: To) {
4003
4004
  }
4004
4005
 
4005
4006
  function isHashChangeOnly(a: Location, b: Location): boolean {
4006
- return (
4007
- a.pathname === b.pathname && a.search === b.search && a.hash !== b.hash
4008
- );
4007
+ if (a.pathname !== b.pathname || a.search !== b.search) {
4008
+ return false;
4009
+ }
4010
+
4011
+ if (a.hash === "") {
4012
+ // No hash -> hash
4013
+ return b.hash !== "";
4014
+ } else if (a.hash === b.hash) {
4015
+ // current hash -> same hash
4016
+ return true;
4017
+ } else if (b.hash !== "") {
4018
+ // current hash -> new hash
4019
+ return true;
4020
+ }
4021
+
4022
+ return false;
4009
4023
  }
4010
4024
 
4011
4025
  function isDeferredResult(result: DataResult): result is DeferredResult {