mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-14 16:52:26 +08:00
fix(react, vue): do not show back button when replacing to root page (#22750)
resolves #22528
This commit is contained in:
@ -174,9 +174,18 @@ class IonRouterInner extends React.PureComponent<IonRouteProps, IonRouteState> {
|
||||
} else if (routeInfo.routeAction === 'replace') {
|
||||
// Make sure to set the lastPathname, etc.. to the current route so the page transitions out
|
||||
const currentRouteInfo = this.locationHistory.current();
|
||||
|
||||
/**
|
||||
* If going from /home to /child, then replacing from
|
||||
* /child to /home, we don't want the route info to
|
||||
* say that /home was pushed by /home which is not correct.
|
||||
*/
|
||||
const currentPushedBy = currentRouteInfo?.pushedByRoute;
|
||||
const pushedByRoute = (currentPushedBy !== undefined && currentPushedBy !== routeInfo.pathname) ? currentPushedBy : routeInfo.pushedByRoute;
|
||||
|
||||
routeInfo.lastPathname = currentRouteInfo?.pathname || routeInfo.lastPathname;
|
||||
routeInfo.prevRouteLastPathname = currentRouteInfo?.lastPathname;
|
||||
routeInfo.pushedByRoute = currentRouteInfo?.pushedByRoute || routeInfo.pushedByRoute;
|
||||
routeInfo.pushedByRoute = pushedByRoute;
|
||||
routeInfo.routeDirection = currentRouteInfo?.routeDirection || routeInfo.routeDirection;
|
||||
routeInfo.routeAnimation = currentRouteInfo?.routeAnimation || routeInfo.routeAnimation;
|
||||
}
|
||||
|
Reference in New Issue
Block a user