@tanstack/router-core 0.0.1-beta.201 → 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.
@@ -1499,6 +1499,7 @@ class Router {
1499
1499
  const fromPathname = dest.from ?? from.pathname;
1500
1500
  let pathname = resolvePath(this.basepath ?? '/', fromPathname, `${dest.to ?? ''}`);
1501
1501
  const fromMatches = this.matchRoutes(fromPathname, from.search);
1502
+ const stayingMatches = matches?.filter(d => fromMatches?.find(e => e.routeId === d.routeId));
1502
1503
  const prevParams = {
1503
1504
  ...last(fromMatches)?.params
1504
1505
  };
@@ -1512,8 +1513,8 @@ class Router {
1512
1513
  });
1513
1514
  }
1514
1515
  pathname = interpolatePath(pathname, nextParams ?? {});
1515
- const preSearchFilters = matches?.map(match => this.getRoute(match.routeId).options.preSearchFilters ?? []).flat().filter(Boolean) ?? [];
1516
- const postSearchFilters = matches?.map(match => this.getRoute(match.routeId).options.postSearchFilters ?? []).flat().filter(Boolean) ?? [];
1516
+ const preSearchFilters = stayingMatches?.map(match => this.getRoute(match.routeId).options.preSearchFilters ?? []).flat().filter(Boolean) ?? [];
1517
+ const postSearchFilters = stayingMatches?.map(match => this.getRoute(match.routeId).options.postSearchFilters ?? []).flat().filter(Boolean) ?? [];
1517
1518
 
1518
1519
  // Pre filters first
1519
1520
  const preFilteredSearch = preSearchFilters?.length ? preSearchFilters?.reduce((prev, next) => next(prev), from.search) : from.search;
@@ -1602,36 +1603,35 @@ class Router {
1602
1603
 
1603
1604
  // If the next urls are the same and we're not replacing,
1604
1605
  // do nothing
1605
- if (isSameUrl && !next.replace) {
1606
- return;
1607
- }
1608
- let {
1609
- maskedLocation,
1610
- ...nextHistory
1611
- } = next;
1612
- if (maskedLocation) {
1613
- nextHistory = {
1614
- ...maskedLocation,
1615
- state: {
1616
- ...maskedLocation.state,
1617
- __tempKey: undefined,
1618
- __tempLocation: {
1619
- ...nextHistory,
1620
- search: nextHistory.searchStr,
1621
- state: {
1622
- ...nextHistory.state,
1623
- __tempKey: undefined,
1624
- __tempLocation: undefined,
1625
- key: undefined
1606
+ if (!isSameUrl || next.replace) {
1607
+ let {
1608
+ maskedLocation,
1609
+ ...nextHistory
1610
+ } = next;
1611
+ if (maskedLocation) {
1612
+ nextHistory = {
1613
+ ...maskedLocation,
1614
+ state: {
1615
+ ...maskedLocation.state,
1616
+ __tempKey: undefined,
1617
+ __tempLocation: {
1618
+ ...nextHistory,
1619
+ search: nextHistory.searchStr,
1620
+ state: {
1621
+ ...nextHistory.state,
1622
+ __tempKey: undefined,
1623
+ __tempLocation: undefined,
1624
+ key: undefined
1625
+ }
1626
1626
  }
1627
1627
  }
1628
+ };
1629
+ if (nextHistory.unmaskOnReload ?? this.options.unmaskOnReload ?? false) {
1630
+ nextHistory.state.__tempKey = this.tempLocationKey;
1628
1631
  }
1629
- };
1630
- if (nextHistory.unmaskOnReload ?? this.options.unmaskOnReload ?? false) {
1631
- nextHistory.state.__tempKey = this.tempLocationKey;
1632
1632
  }
1633
+ this.history[next.replace ? 'replace' : 'push'](nextHistory.href, nextHistory.state);
1633
1634
  }
1634
- this.history[next.replace ? 'replace' : 'push'](nextHistory.href, nextHistory.state);
1635
1635
  this.resetNextScroll = next.resetScroll ?? true;
1636
1636
  return this.latestLoadPromise;
1637
1637
  };