Subscription + navigation

#1

I’m using Ionic v3 with Firebase push notifications (@ionic-native/firebase) and redux (@ngrx/store).

In my use case, the flow goes:

  1. A push notification is received.
  2. The redux store is modified.
  3. A page navigation takes place.

The problem is that after the page navigation, the -new- page is broken (that is, the buttons don’t work or do strange things).

My code looks like:

const self = this;

this.firebase.onNotificationOpen()
         .subscribe( (data) => {
           self.handle_notification(data);
         });

handle_notification(data){
         this.store.dispatch(new theReduxAction());
}

this.store.select('state').select('the_redux_action')
        .subscribe( (data) => {
          self.handle_redux(data);
        });

handle_redux(data){
         this.navCtrl.push('new_page');
}

For the sake of testing, I tried calling self.handle_notification(data) from outside the firebase .subscribe() function (as in, when clicking a button, or from an interval callback), and it works perfectly.

Does anyone have a hint why this breaks?