@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.
@@ -1872,6 +1872,7 @@
1872
1872
  const fromPathname = dest.from ?? from.pathname;
1873
1873
  let pathname = resolvePath(this.basepath ?? '/', fromPathname, `${dest.to ?? ''}`);
1874
1874
  const fromMatches = this.matchRoutes(fromPathname, from.search);
1875
+ const stayingMatches = matches?.filter(d => fromMatches?.find(e => e.routeId === d.routeId));
1875
1876
  const prevParams = {
1876
1877
  ...last(fromMatches)?.params
1877
1878
  };
@@ -1885,8 +1886,8 @@
1885
1886
  });
1886
1887
  }
1887
1888
  pathname = interpolatePath(pathname, nextParams ?? {});
1888
- const preSearchFilters = matches?.map(match => this.getRoute(match.routeId).options.preSearchFilters ?? []).flat().filter(Boolean) ?? [];
1889
- const postSearchFilters = matches?.map(match => this.getRoute(match.routeId).options.postSearchFilters ?? []).flat().filter(Boolean) ?? [];
1889
+ const preSearchFilters = stayingMatches?.map(match => this.getRoute(match.routeId).options.preSearchFilters ?? []).flat().filter(Boolean) ?? [];
1890
+ const postSearchFilters = stayingMatches?.map(match => this.getRoute(match.routeId).options.postSearchFilters ?? []).flat().filter(Boolean) ?? [];
1890
1891
 
1891
1892
  // Pre filters first
1892
1893
  const preFilteredSearch = preSearchFilters?.length ? preSearchFilters?.reduce((prev, next) => next(prev), from.search) : from.search;
@@ -1975,36 +1976,35 @@
1975
1976
 
1976
1977
  // If the next urls are the same and we're not replacing,
1977
1978
  // do nothing
1978
- if (isSameUrl && !next.replace) {
1979
- return;
1980
- }
1981
- let {
1982
- maskedLocation,
1983
- ...nextHistory
1984
- } = next;
1985
- if (maskedLocation) {
1986
- nextHistory = {
1987
- ...maskedLocation,
1988
- state: {
1989
- ...maskedLocation.state,
1990
- __tempKey: undefined,
1991
- __tempLocation: {
1992
- ...nextHistory,
1993
- search: nextHistory.searchStr,
1994
- state: {
1995
- ...nextHistory.state,
1996
- __tempKey: undefined,
1997
- __tempLocation: undefined,
1998
- key: undefined
1979
+ if (!isSameUrl || next.replace) {
1980
+ let {
1981
+ maskedLocation,
1982
+ ...nextHistory
1983
+ } = next;
1984
+ if (maskedLocation) {
1985
+ nextHistory = {
1986
+ ...maskedLocation,
1987
+ state: {
1988
+ ...maskedLocation.state,
1989
+ __tempKey: undefined,
1990
+ __tempLocation: {
1991
+ ...nextHistory,
1992
+ search: nextHistory.searchStr,
1993
+ state: {
1994
+ ...nextHistory.state,
1995
+ __tempKey: undefined,
1996
+ __tempLocation: undefined,
1997
+ key: undefined
1998
+ }
1999
1999
  }
2000
2000
  }
2001
+ };
2002
+ if (nextHistory.unmaskOnReload ?? this.options.unmaskOnReload ?? false) {
2003
+ nextHistory.state.__tempKey = this.tempLocationKey;
2001
2004
  }
2002
- };
2003
- if (nextHistory.unmaskOnReload ?? this.options.unmaskOnReload ?? false) {
2004
- nextHistory.state.__tempKey = this.tempLocationKey;
2005
2005
  }
2006
+ this.history[next.replace ? 'replace' : 'push'](nextHistory.href, nextHistory.state);
2006
2007
  }
2007
- this.history[next.replace ? 'replace' : 'push'](nextHistory.href, nextHistory.state);
2008
2008
  this.resetNextScroll = next.resetScroll ?? true;
2009
2009
  return this.latestLoadPromise;
2010
2010
  };