Reset a tab after going to different tab

My app has 4 tabs (A, B, C, D). Tab D contains a list. Touching a list item goes to the detail page. While on the detail page, when I go to any other tab, then back to D, it still shows the detail page instead of the list. I’d like it to ALWAYS show the list every time I go to tab D, no matter what I did in D before. Same for the other tabs.

How do I do that? Thanks.

Found a solution here Ionic Tabs Clear history after naivgation
In the tabs page, add an ionChange attribute like so…

<ion-tabs (ionChange) = "tabChanged($event)">

and in the code-behind, add the following…

  tabChanged($ev)
  {
    switch ($ev.tabTitle) {
      case "Tab A":
        $ev.setRoot('Tab_A_Page');
        break;
    
      case "B":
        $ev.setRoot('Tab_B_Page');
        break;
    
     ....
  }

Hope this helps.