Ionic 4 empty back button subscription goes back

I have an empty back button subscription. I would expect that it wouldn’t do anything, but oddly enough it is navigating back. If I comment out the line, the back button goes back to not doing anything.

this.customBackActionSubscription = this.platform.backButton.subscribe(async (data) => {

    });

Hmm, seems to have resolved itself. False alarm I guess? Feel free to close.

And now the issue is back :sob:

I get in the logcat:

D/SystemWebChromeClient: http://localhost:8080/vendor.js: Line 90283 : ERROR

But my subscriptions try catch error block is not invoked.

      try {
          console.log('in the try clause');
          const element = await this.modalCtrl.getTop();
          if (element) {
            element.dismiss();
            return;
          }
        } catch (error) {
          console.log('we got a big ol\' error');
          console.log(error.errorMessage);
        }

        return;

And then the app is navigating back instead of just closing the modal.

Figured it out finally. In my case I had some navigation using angular’s Router instead of Ionic’s NavController.

Please tell me how did you handled that. I am facing the same issue

As I said, in my case I just needed to remove any router.navigate functions and replace them with navcontroller.navigateRoot, which is Ionic’s navigation controller.