diff --git a/packages/react-router/src/ReactRouter/IonRouter.tsx b/packages/react-router/src/ReactRouter/IonRouter.tsx index 8be94900615..50794eafccb 100644 --- a/packages/react-router/src/ReactRouter/IonRouter.tsx +++ b/packages/react-router/src/ReactRouter/IonRouter.tsx @@ -241,7 +241,7 @@ class IonRouterInner extends React.PureComponent { routeDirection: 'back', routeAnimation: routeAnimation || routeInfo.routeAnimation, }; - if (routeInfo.lastPathname === routeInfo.pushedByRoute) { + if (routeInfo.lastPathname === routeInfo.pushedByRoute || prevInfo.pathname === routeInfo.pushedByRoute) { this.props.history.goBack(); } else { this.handleNavigate(prevInfo.pathname + (prevInfo.search || ''), 'pop', 'back'); diff --git a/packages/vue-router/src/router.ts b/packages/vue-router/src/router.ts index a84ae558fef..76aea4c57ad 100644 --- a/packages/vue-router/src/router.ts +++ b/packages/vue-router/src/router.ts @@ -88,7 +88,7 @@ export const createIonRouter = (opts: IonicVueRouterOptions, router: Router) => const prevInfo = locationHistory.findLastLocation(routeInfo); if (prevInfo) { incomingRouteParams = { ...prevInfo, routerAction: 'pop', routerDirection: 'back', routerAnimation: routerAnimation || routeInfo.routerAnimation }; - if (routeInfo.lastPathname === routeInfo.pushedByRoute) { + if (routeInfo.lastPathname === routeInfo.pushedByRoute || prevInfo.pathname === routeInfo.pushedByRoute) { router.back(); } else { router.replace({ path: prevInfo.pathname, query: parseQuery(prevInfo.search) });