Back button issue. Previous page is not triggerring any methods

I was in home page, and then i went to another page to add a record. And then i am coming back to home page. In home page i need to show the record(s) added.

In add page, i tried with ion-back-button

<ion-back-button></ion-back-button>

I also tried to use a custom button

<ion-header>
  <ion-toolbar>
    <ion-buttons slot="start">
      <ion-button (click)="changeRoute()">Back</ion-button>
    </ion-buttons>
    <ion-title>Reminder</ion-title>
  </ion-toolbar>
</ion-header>

And the route change function is as below

changeRoute() {
    this.router.navigate(['/home']);
}

But still, in the home page, none of the below methods are triggering.

ionViewWillEnter() {
    console.log('ionViewWillEnter')
  }
  ionViewDidLoad() {
    console.log('ionViewDidLoad')
  }
  ionViewWillLeave() {
    console.log('ionViewWillLeave')
  }
  ionViewDidLeave() {
    console.log('ionViewDidLeave')
  }
  ionViewWillUnload() {
    console.log('ionViewWillUnload')
  }
  ionViewDidEnter() {
    console.log('ionViewDidEnter');
  }

My ionic version info is as below

Any help would be appreciated.

My advice would be to stop abusing lifecycle events to deal with stale data concerns.

how do you reload the data then?

“Reload the data” is too vague for me to say much constructive about, aside from the detailed code example given in the link.

I want to simply reload the data by making an api call. I don’t want to make it complex.

My point is less about how to reload the data than when, and I’m saying that page lifecycle events are a bad way to determine when. If you want a user action to initiate this, I would add an explicit refresh button or a component like ion-refresher.

That’s one way. But i don’t want the user to go and refresh himself. When he come back to same page, we should just fetch all records and show him. Basically it should be seamless.

This makes no sense to me. If new records are being added by some external forces, I see no difference between the user sitting on the page and the user going somewhere else and coming back to that page. I dislike polling strategies for mobile apps because of battery concerns, but polling is another way to handle this, which (if you follow the general Observable approach) can be seamlessly integrated.

So I fundamentally disagree that “leaving a page and coming back to it” constitutes a reasonable trigger for refreshing anything, especially compared to something like pull-to-refresh.

Perhaps, however, you will find some other kindred soul who agrees with you to continue this conversation with.