From fc6e482162bd696e67b12005ae363b8650e2342c Mon Sep 17 00:00:00 2001 From: ShaneK Date: Wed, 26 Nov 2025 10:17:12 -0800 Subject: [PATCH] chore(react-router): cleaning up console logs --- .../src/ReactRouter/ReactRouterViewStack.tsx | 27 ------ .../src/ReactRouter/StackManager.tsx | 84 ------------------- .../utils/matchRoutesFromChildren.ts | 11 --- .../test/base/src/pages/routing/Tabs.tsx | 5 +- .../react/src/components/IonRouterOutlet.tsx | 2 - packages/react/src/routing/LocationHistory.ts | 4 - packages/react/src/routing/PageManager.tsx | 1 - 7 files changed, 1 insertion(+), 133 deletions(-) diff --git a/packages/react-router/src/ReactRouter/ReactRouterViewStack.tsx b/packages/react-router/src/ReactRouter/ReactRouterViewStack.tsx index 5b39504997..9155dd93e2 100644 --- a/packages/react-router/src/ReactRouter/ReactRouterViewStack.tsx +++ b/packages/react-router/src/ReactRouter/ReactRouterViewStack.tsx @@ -187,7 +187,6 @@ export class ReactRouterViewStack extends ViewStacks { // Add infinite loop detection with a more reasonable limit // In complex navigation flows, we may have many view items across different outlets if (this.viewItemCounter > 100) { - console.warn(`[ReactRouterViewStack] Many view items created (${this.viewItemCounter}). Performing cleanup.`); // Clean up all outlets to prevent memory leaks this.getStackIds().forEach((stackId) => this.cleanupStaleViewItems(stackId)); // Reset counter to a lower value after cleanup @@ -477,10 +476,6 @@ export class ReactRouterViewStack extends ViewStacks { if (hasRelativeRoutes || hasIndexRoute) { const segments = routeInfo.pathname.split('/').filter(Boolean); - if (process.env.NODE_ENV !== 'production') { - console.log(`[ReactRouterViewStack] getChildrenToRender outlet=${outletId}: computing parentPath for ${routeInfo.pathname}`); - } - // Two-pass algorithm: // Pass 1: Look for specific route matches OR index routes (prefer real routes) // Pass 2: If no match found, use wildcard fallback @@ -511,9 +506,6 @@ export class ReactRouterViewStack extends ViewStacks { }); if (hasSpecificMatch) { - if (process.env.NODE_ENV !== 'production') { - console.log(`[ReactRouterViewStack] Found specific match at parentPath=${testParentPath}, remaining=${testRemainingPath}`); - } parentPath = testParentPath; break; } @@ -525,9 +517,6 @@ export class ReactRouterViewStack extends ViewStacks { if (!wildcardFallbackPath && (testRemainingPath === '' || testRemainingPath === '/')) { const hasIndexMatch = routeChildren.some((route) => !!(route.props as any).index); if (hasIndexMatch) { - if (process.env.NODE_ENV !== 'production') { - console.log(`[ReactRouterViewStack] Found index match at parentPath=${testParentPath}`); - } parentPath = testParentPath; break; } @@ -570,9 +559,6 @@ export class ReactRouterViewStack extends ViewStacks { // Pass 2: If no specific/index match found, use wildcard fallback if (!parentPath && wildcardFallbackPath) { - if (process.env.NODE_ENV !== 'production') { - console.log(`[ReactRouterViewStack] Using wildcard fallback at parentPath=${wildcardFallbackPath}`); - } parentPath = wildcardFallbackPath; } } @@ -646,9 +632,6 @@ export class ReactRouterViewStack extends ViewStacks { findLeavingViewItemByRouteInfo = (routeInfo: RouteInfo, outletId?: string, mustBeIonRoute = true) => { // If the lastPathname is not set, we cannot find a leaving view item if (!routeInfo.lastPathname) { - if (process.env.NODE_ENV !== 'production') { - console.warn(`[ReactRouterViewStack] No matching leaving view item found for: ${routeInfo.pathname}`); - } return undefined; } @@ -732,16 +715,6 @@ export class ReactRouterViewStack extends ViewStacks { // Do not adopt across outlets; if we didn't find a view for this outlet, // defer to route matching to create a new one. - if (!viewItem && process.env.NODE_ENV !== 'production') { - const allViewItems = this.getAllViewItems(); - console.warn( - `[ReactRouterViewStack] No matching view item found for: ${pathname}. Available views:`, - allViewItems - .map((v) => `${v.id}(outlet:${v.outletId}, path:${v.routeData?.childProps?.path || 'undefined'})`) - .join(', ') - ); - } - return { viewItem, match }; /** diff --git a/packages/react-router/src/ReactRouter/StackManager.tsx b/packages/react-router/src/ReactRouter/StackManager.tsx index 1d2afcd6f7..7b6f697a3a 100644 --- a/packages/react-router/src/ReactRouter/StackManager.tsx +++ b/packages/react-router/src/ReactRouter/StackManager.tsx @@ -239,13 +239,6 @@ export class StackManager extends React.PureComponent { - if (process.env.NODE_ENV !== 'production') { - console.log(`[StackManager:outOfScope] Removing view ${viewItem.id} from outlet ${this.id}, isNavigate=${isNavigateViewItem(viewItem)}`); - } if (viewItem.ionPageElement) { viewItem.ionPageElement.classList.add('ion-page-hidden'); viewItem.ionPageElement.setAttribute('aria-hidden', 'true'); @@ -490,9 +470,6 @@ export class StackManager extends React.PureComponent { - useEffect(() => { - console.log('[Tabs] Mounted'); - }, []); return ( diff --git a/packages/react/src/components/IonRouterOutlet.tsx b/packages/react/src/components/IonRouterOutlet.tsx index 2c560a82e3..2fe25df389 100644 --- a/packages/react/src/components/IonRouterOutlet.tsx +++ b/packages/react/src/components/IonRouterOutlet.tsx @@ -37,8 +37,6 @@ class IonRouterOutletContainer extends React.Component diff --git a/packages/react/src/routing/LocationHistory.ts b/packages/react/src/routing/LocationHistory.ts index f2c185a723..31dd77c85e 100644 --- a/packages/react/src/routing/LocationHistory.ts +++ b/packages/react/src/routing/LocationHistory.ts @@ -96,13 +96,9 @@ export class LocationHistory { // Get the current route that's being replaced const currentRoute = this.locationHistory[this.locationHistory.length - 1]; - console.log('[LocationHistory._replace] currentRoute:', currentRoute?.pathname, 'tab:', currentRoute?.tab); - console.log('[LocationHistory._replace] newRoute:', routeInfo.pathname, 'tab:', routeInfo.tab); - // Only pop from global history if we're replacing in the same outlet context. // Don't pop if we're entering a nested outlet (current route has no tab, new route has a tab) const isEnteringNestedOutlet = currentRoute && !currentRoute.tab && !!routeInfo.tab; - console.log('[LocationHistory._replace] isEnteringNestedOutlet:', isEnteringNestedOutlet); if (!isEnteringNestedOutlet) { this.locationHistory.pop(); diff --git a/packages/react/src/routing/PageManager.tsx b/packages/react/src/routing/PageManager.tsx index 2b0f4b76e1..19a184a636 100644 --- a/packages/react/src/routing/PageManager.tsx +++ b/packages/react/src/routing/PageManager.tsx @@ -41,7 +41,6 @@ export class PageManager extends React.PureComponent { if (this.context.isInOutlet()) { this.ionPageElementRef.current.classList.add('ion-page-invisible'); } - console.log('[PageManager] componentDidMount for', this.props.routeInfo?.pathname); this.context.registerIonPage(this.ionPageElementRef.current, this.props.routeInfo!); this.ionPageElementRef.current.addEventListener('ionViewWillEnter', this.ionViewWillEnterHandler); this.ionPageElementRef.current.addEventListener('ionViewDidEnter', this.ionViewDidEnterHandler);