fix(angular): do not navigate to same tab if already active (#21085)

fixes #21074, fixes #19943
This commit is contained in:
Liam DeBeasi
2020-04-27 12:19:23 -04:00
committed by GitHub
parent 671802f9a2
commit 15203de08b

View File

@ -91,6 +91,12 @@ export class IonTabs {
const alreadySelected = this.outlet.getActiveStackId() === tab;
const tabRootUrl = `${this.outlet.tabsPrefix}/${tab}`;
if (alreadySelected) {
const activeStackId = this.outlet.getActiveStackId();
const activeView = this.outlet.getLastRouteView(activeStackId);
// If on root tab, do not navigate to root tab again
if (activeView.url === tabRootUrl) { return; }
const rootView = this.outlet.getRootView(tab);
const navigationExtras = rootView && tabRootUrl === rootView.url && rootView.savedExtras;
return this.navCtrl.navigateRoot(tabRootUrl, {