@tanstack/react-router 1.101.0 → 1.102.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-router",
3
- "version": "1.101.0",
3
+ "version": "1.102.0",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -54,7 +54,7 @@
54
54
  "tiny-invariant": "^1.3.3",
55
55
  "tiny-warning": "^1.0.3",
56
56
  "@tanstack/history": "1.99.13",
57
- "@tanstack/router-core": "^1.99.13"
57
+ "@tanstack/router-core": "^1.102.0"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@testing-library/jest-dom": "^6.6.3",
package/src/router.ts CHANGED
@@ -1744,13 +1744,21 @@ export class Router<
1744
1744
  ...next
1745
1745
  }: ParsedLocation & CommitLocationOptions): Promise<void> => {
1746
1746
  const isSameState = () => {
1747
- // `state.key` is ignored but may still be provided when navigating,
1748
- // temporarily add the previous key to the next state so it doesn't affect
1747
+ // the following props are ignored but may still be provided when navigating,
1748
+ // temporarily add the previous values to the next state so they don't affect
1749
1749
  // the comparison
1750
-
1751
- next.state.key = this.latestLocation.state.key
1750
+ const ignoredProps = [
1751
+ 'key',
1752
+ '__TSR_index',
1753
+ '__hashScrollIntoViewOptions',
1754
+ ] as const
1755
+ ignoredProps.forEach((prop) => {
1756
+ ;(next.state as any)[prop] = this.latestLocation.state[prop]
1757
+ })
1752
1758
  const isEqual = deepEqual(next.state, this.latestLocation.state)
1753
- delete next.state.key
1759
+ ignoredProps.forEach((prop) => {
1760
+ delete next.state[prop]
1761
+ })
1754
1762
  return isEqual
1755
1763
  }
1756
1764