@remix-run/router 1.6.0-pre.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/CHANGELOG.md CHANGED
@@ -1,17 +1,25 @@
1
1
  # `@remix-run/router`
2
2
 
3
- ## 1.6.0-pre.0
3
+ ## 1.6.1-pre.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix basename handling when navigating without a path ([#10433](https://github.com/remix-run/react-router/pull/10433))
8
+ - "Same hash" navigations no longer re-run loaders to match browser behavior (i.e. `/path#hash -> /path#hash`) ([#10408](https://github.com/remix-run/react-router/pull/10408))
9
+
10
+ ## 1.6.0
4
11
 
5
12
  ### Minor Changes
6
13
 
7
- - - Enable relative routing in the `@remix-run/router` when providing a source route ID from which the path is relative to: ([#10336](https://github.com/remix-run/react-router/pull/10336))
14
+ - Enable relative routing in the `@remix-run/router` when providing a source route ID from which the path is relative to: ([#10336](https://github.com/remix-run/react-router/pull/10336))
15
+
16
+ - Example: `router.navigate("../path", { fromRouteId: "some-route" })`.
17
+ - This also applies to `router.fetch` which already receives a source route ID
8
18
 
9
- - Example: `router.navigate("../path", { fromRouteId: "some-route" })`.
10
- - This also applies to `router.fetch` which already receives a source route ID
19
+ - Introduce a new `@remix-run/router` `future.v7_prependBasename` flag to enable `basename` prefixing to all paths coming into `router.navigate` and `router.fetch`.
11
20
 
12
- - Introduce a new `@remix-run/router` `future.v7_prependBasename` flag to enable `basename` prefixing to all paths coming into `router.navigate` and `router.fetch`.
13
- - Previously the `basename` was prepended in the React Router layer, but now that relative routing is being handled by the router we need prepend the `basename` _after_ resolving any relative paths
14
- - This also enables `basename` support in `useFetcher` as well
21
+ - Previously the `basename` was prepended in the React Router layer, but now that relative routing is being handled by the router we need prepend the `basename` _after_ resolving any relative paths
22
+ - This also enables `basename` support in `useFetcher` as well
15
23
 
16
24
  ### Patch Changes
17
25
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/router v1.6.0-pre.0
2
+ * @remix-run/router v1.6.1-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -3454,7 +3454,7 @@ function normalizeTo(location, matches, basename, prependBasename, to, fromRoute
3454
3454
  } // Resolve the relative path
3455
3455
 
3456
3456
 
3457
- 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
3457
+ 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
3458
3458
  // location, unlike when to="." and we just inherit the path.
3459
3459
  // See https://github.com/remix-run/remix/issues/927
3460
3460
 
@@ -3588,7 +3588,7 @@ function getMatchesToLoad(history, state, matches, submission, location, isReval
3588
3588
  actionResult,
3589
3589
  defaultShouldRevalidate: // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate
3590
3590
  isRevalidationRequired || // Clicked the same link, resubmitted a GET form
3591
- currentUrl.toString() === nextUrl.toString() || // Search params affect all loaders
3591
+ currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search || // Search params affect all loaders
3592
3592
  currentUrl.search !== nextUrl.search || isNewRouteInstance(currentRouteMatch, nextRouteMatch)
3593
3593
  }));
3594
3594
  }); // Pick fetcher.loads that need to be revalidated
@@ -4203,7 +4203,22 @@ function stripHashFromPath(path) {
4203
4203
  }
4204
4204
 
4205
4205
  function isHashChangeOnly(a, b) {
4206
- return a.pathname === b.pathname && a.search === b.search && a.hash !== b.hash;
4206
+ if (a.pathname !== b.pathname || a.search !== b.search) {
4207
+ return false;
4208
+ }
4209
+
4210
+ if (a.hash === "") {
4211
+ // No hash -> hash
4212
+ return b.hash !== "";
4213
+ } else if (a.hash === b.hash) {
4214
+ // current hash -> same hash
4215
+ return true;
4216
+ } else if (b.hash !== "") {
4217
+ // current hash -> new hash
4218
+ return true;
4219
+ }
4220
+
4221
+ return false;
4207
4222
  }
4208
4223
 
4209
4224
  function isDeferredResult(result) {