@tanstack/router-core 0.0.1-beta.202 → 0.0.1-beta.203

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/router-core",
3
3
  "author": "Tanner Linsley",
4
- "version": "0.0.1-beta.202",
4
+ "version": "0.0.1-beta.203",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router",
@@ -44,7 +44,7 @@
44
44
  "tiny-warning": "^1.0.3",
45
45
  "@tanstack/store": "^0.0.1",
46
46
  "@gisatcz/cross-package-react-context": "^0.2.0",
47
- "@tanstack/history": "0.0.1-beta.202"
47
+ "@tanstack/history": "0.0.1-beta.203"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "rollup --config rollup.config.js",
package/src/router.ts CHANGED
@@ -1682,6 +1682,9 @@ export class Router<
1682
1682
  )
1683
1683
 
1684
1684
  const fromMatches = this.matchRoutes(fromPathname, from.search)
1685
+ const stayingMatches = matches?.filter((d) =>
1686
+ fromMatches?.find((e) => e.routeId === d.routeId),
1687
+ )
1685
1688
 
1686
1689
  const prevParams = { ...last(fromMatches)?.params }
1687
1690
 
@@ -1702,7 +1705,7 @@ export class Router<
1702
1705
  pathname = interpolatePath(pathname, nextParams ?? {})
1703
1706
 
1704
1707
  const preSearchFilters =
1705
- matches
1708
+ stayingMatches
1706
1709
  ?.map(
1707
1710
  (match) =>
1708
1711
  this.getRoute(match.routeId).options.preSearchFilters ?? [],
@@ -1711,7 +1714,7 @@ export class Router<
1711
1714
  .filter(Boolean) ?? []
1712
1715
 
1713
1716
  const postSearchFilters =
1714
- matches
1717
+ stayingMatches
1715
1718
  ?.map(
1716
1719
  (match) =>
1717
1720
  this.getRoute(match.routeId).options.postSearchFilters ?? [],
@@ -1856,40 +1859,42 @@ export class Router<
1856
1859
 
1857
1860
  // If the next urls are the same and we're not replacing,
1858
1861
  // do nothing
1859
- if (isSameUrl && !next.replace) {
1860
- return
1861
- }
1862
-
1863
- let { maskedLocation, ...nextHistory } = next
1864
-
1865
- if (maskedLocation) {
1866
- nextHistory = {
1867
- ...maskedLocation,
1868
- state: {
1869
- ...maskedLocation.state,
1870
- __tempKey: undefined,
1871
- __tempLocation: {
1872
- ...nextHistory,
1873
- search: nextHistory.searchStr,
1874
- state: {
1875
- ...nextHistory.state,
1876
- __tempKey: undefined!,
1877
- __tempLocation: undefined!,
1878
- key: undefined!,
1862
+ if (!isSameUrl || next.replace) {
1863
+ let { maskedLocation, ...nextHistory } = next
1864
+
1865
+ if (maskedLocation) {
1866
+ nextHistory = {
1867
+ ...maskedLocation,
1868
+ state: {
1869
+ ...maskedLocation.state,
1870
+ __tempKey: undefined,
1871
+ __tempLocation: {
1872
+ ...nextHistory,
1873
+ search: nextHistory.searchStr,
1874
+ state: {
1875
+ ...nextHistory.state,
1876
+ __tempKey: undefined!,
1877
+ __tempLocation: undefined!,
1878
+ key: undefined!,
1879
+ },
1879
1880
  },
1880
1881
  },
1881
- },
1882
- }
1882
+ }
1883
1883
 
1884
- if (nextHistory.unmaskOnReload ?? this.options.unmaskOnReload ?? false) {
1885
- nextHistory.state.__tempKey = this.tempLocationKey
1884
+ if (
1885
+ nextHistory.unmaskOnReload ??
1886
+ this.options.unmaskOnReload ??
1887
+ false
1888
+ ) {
1889
+ nextHistory.state.__tempKey = this.tempLocationKey
1890
+ }
1886
1891
  }
1887
- }
1888
1892
 
1889
- this.history[next.replace ? 'replace' : 'push'](
1890
- nextHistory.href,
1891
- nextHistory.state,
1892
- )
1893
+ this.history[next.replace ? 'replace' : 'push'](
1894
+ nextHistory.href,
1895
+ nextHistory.state,
1896
+ )
1897
+ }
1893
1898
 
1894
1899
  this.resetNextScroll = next.resetScroll ?? true
1895
1900