fix(react, vue): correct view now chosen when going back inside tabs (#23154)

resolves #23087
resolves #23101
This commit is contained in:
Liam DeBeasi
2021-04-06 10:16:23 -04:00
committed by GitHub
parent 42e6c90c46
commit 7203190234
7 changed files with 293 additions and 2 deletions

View File

@ -243,7 +243,19 @@ class IonRouterInner extends React.PureComponent<IonRouteProps, IonRouteState> {
routeDirection: 'back',
routeAnimation: routeAnimation || routeInfo.routeAnimation,
};
if (routeInfo.lastPathname === routeInfo.pushedByRoute || prevInfo.pathname === routeInfo.pushedByRoute) {
if (
routeInfo.lastPathname === routeInfo.pushedByRoute ||
(
/**
* We need to exclude tab switches/tab
* context changes here because tabbed
* navigation is not linear, but router.back()
* will go back in a linear fashion.
*/
prevInfo.pathname === routeInfo.pushedByRoute &&
routeInfo.tab === '' && prevInfo.tab === ''
)
) {
this.props.history.goBack();
} else {
this.handleNavigate(prevInfo.pathname + (prevInfo.search || ''), 'pop', 'back');