Issue with menu / back buttons after navigating to new page (Ionic 4)


#1

Hi there,

I am having a bit of an issue with menu button / back button where they are not displaying or redirecting incorrectly after I do a programmatic navigation to a new route.

Basically we have process on init where we check if the user is authenticated already, and depending on the result we redirect them to specific locations, as per below:

initializeApp() {
        this.platform.ready().then(() => {
            this.statusBar.styleDefault();

            this.oauth.tokensExists().then((result) => {
                if (result) {
                    this.auth.authenticationState.subscribe(state => {
                        this.splashScreen.hide();

                        if (state) {
                            this.router.navigate(['member', 'wallet']);
                        } else {
                            this.router.navigate(['login']);
                        }
                    });
                } else {
                    this.splashScreen.hide();
                    this.router.navigate(['home']);
                }
            });
        });
    }

This is working fine and it’s navigating correctly, but when we land on the ‘wallet’ page it should be showing the menu button top right, as per this code

 <ion-buttons slot="start">
      <ion-menu-button></ion-menu-button>
    </ion-buttons>

But it doesn’t show at all! But if I do a refresh on the wallet page it appears and works fine. I assume this has something to do with being routed there but I can’t find any reference to this anywhere - does anyone know why?

Additionally to this, if we logout via the menu and do a navigate to the login page again, the top menu shows a back button which when pressed, redirects people back to the wallet. I assume this is intentional, but how do we specify that the back button on the login should go back to home instead?