@ionic/react 8.8.1-dev.11773676615.1d6c4cf7 → 8.8.1-dev.11773873479.192398dc

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/dist/index.js CHANGED
@@ -1591,7 +1591,9 @@ const matchesTab = (pathname, href) => {
1591
1591
  if (href === undefined) {
1592
1592
  return false;
1593
1593
  }
1594
- const normalizedHref = href.endsWith('/') && href !== '/' ? href.slice(0, -1) : href;
1594
+ // Strip query string before comparing — href may contain search params (e.g., "/tabs/home?foo=bar")
1595
+ const hrefPathname = href.split('?')[0];
1596
+ const normalizedHref = hrefPathname.endsWith('/') && hrefPathname !== '/' ? hrefPathname.slice(0, -1) : hrefPathname;
1595
1597
  return pathname === normalizedHref || pathname.startsWith(normalizedHref + '/');
1596
1598
  };
1597
1599
  class IonTabBarUnwrapped extends React.PureComponent {
@@ -1683,7 +1685,7 @@ class IonTabBarUnwrapped extends React.PureComponent {
1683
1685
  const prevHref = state.tabs[prevActiveTab].currentHref;
1684
1686
  const prevRouteOptions = state.tabs[prevActiveTab].currentRouteOptions;
1685
1687
  if (activeTab !== prevActiveTab ||
1686
- prevHref !== props.routeInfo?.pathname ||
1688
+ prevHref !== (props.routeInfo?.pathname || '') + (props.routeInfo?.search || '') ||
1687
1689
  prevRouteOptions !== props.routeInfo?.routeOptions) {
1688
1690
  tabs[activeTab] = {
1689
1691
  originalHref: tabs[activeTab].originalHref,
@@ -1750,7 +1752,7 @@ class IonTabBarUnwrapped extends React.PureComponent {
1750
1752
  return (child) => {
1751
1753
  if (child != null && child.props && (child.type === IonTabButton || child.type.isTabButton)) {
1752
1754
  const href = child.props.tab === activeTab
1753
- ? this.props.routeInfo?.pathname
1755
+ ? (this.props.routeInfo?.pathname || '') + (this.props.routeInfo?.search || '')
1754
1756
  : this.state.tabs[child.props.tab].currentHref;
1755
1757
  const routeOptions = child.props.tab === activeTab
1756
1758
  ? this.props.routeInfo?.routeOptions
@@ -2429,6 +2431,20 @@ class LocationHistory {
2429
2431
  }
2430
2432
  return undefined;
2431
2433
  }
2434
+ /**
2435
+ * Returns the most recent RouteInfo in global history (excluding the current
2436
+ * entry) whose pathname matches the given value. Unlike findLastLocation,
2437
+ * this search is tab-agnostic. Used by the multi-step back detection.
2438
+ */
2439
+ findLastLocationByPathname(pathname) {
2440
+ for (let i = this.locationHistory.length - 2; i >= 0; i--) {
2441
+ const ri = this.locationHistory[i];
2442
+ if (ri && ri.pathname === pathname) {
2443
+ return ri;
2444
+ }
2445
+ }
2446
+ return undefined;
2447
+ }
2432
2448
  findLastLocation(routeInfo) {
2433
2449
  const routeInfos = this._getRouteInfosByKey(routeInfo.tab);
2434
2450
  if (routeInfos) {