fix(react, vue): navigating using ion-back-button now selects correct page (#22974)

resolves #22830
This commit is contained in:
Liam DeBeasi
2021-02-25 13:18:20 -05:00
committed by GitHub
parent b6b2714d70
commit cd8ffd82a0
2 changed files with 2 additions and 2 deletions

View File

@ -241,7 +241,7 @@ class IonRouterInner extends React.PureComponent<IonRouteProps, IonRouteState> {
routeDirection: 'back', routeDirection: 'back',
routeAnimation: routeAnimation || routeInfo.routeAnimation, routeAnimation: routeAnimation || routeInfo.routeAnimation,
}; };
if (routeInfo.lastPathname === routeInfo.pushedByRoute) { if (routeInfo.lastPathname === routeInfo.pushedByRoute || prevInfo.pathname === routeInfo.pushedByRoute) {
this.props.history.goBack(); this.props.history.goBack();
} else { } else {
this.handleNavigate(prevInfo.pathname + (prevInfo.search || ''), 'pop', 'back'); this.handleNavigate(prevInfo.pathname + (prevInfo.search || ''), 'pop', 'back');

View File

@ -88,7 +88,7 @@ export const createIonRouter = (opts: IonicVueRouterOptions, router: Router) =>
const prevInfo = locationHistory.findLastLocation(routeInfo); const prevInfo = locationHistory.findLastLocation(routeInfo);
if (prevInfo) { if (prevInfo) {
incomingRouteParams = { ...prevInfo, routerAction: 'pop', routerDirection: 'back', routerAnimation: routerAnimation || routeInfo.routerAnimation }; 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(); router.back();
} else { } else {
router.replace({ path: prevInfo.pathname, query: parseQuery(prevInfo.search) }); router.replace({ path: prevInfo.pathname, query: parseQuery(prevInfo.search) });