ionic-team / ionic-team/ionic-framework
bug: starting on tab child page, going back to root causes root tab to get unmounted when pushing to child page
- Lingua principale
- TypeScript
- Stelle
- 52.7k
- Fork
- 13.3k
- Merge medio
- 1g 15h
- PR unite (30g)
- 51
Descrizione
# Feature Request
**Ionic version:**
[x] **4.7.0**
**Description**
When working with an Ionic tabs application, the page/module that is attributed to a given tab is loaded directly under the `ion-router-outlet` of the `ion-tabs`.
Let's say that from the page that is related to this tab (app-parent), we navigate to another page (app-child). In this case both `app-parent` and `app-child` will be under the `ion-router-outlet` of the `ion-tabs`:

When navigating back from the child page to the parent page, the child page is destroyed and we've got only the parent page inside the `ion-tabs`.
Now let's say that we are inside the child page, **we reload the page**, and then we navigate back to the parent page. In this case we will have both the `app-parent` and `app-child` under the `ion-tabs`, but with an inverted order:

And when navigating forward from the parent page to the child page, the parent page gets destroyed, and only the child page remains under the `ion-tabs`.
**Preferred Solution**
When setting a default page to the tab, it is suitable that this page remains and doesn't get destroyed. The described behavior happens only when the app is reloaded from another page than the default-related-tab page.
Would it be possible that when reloading the app from a child page (like for example `/tabs/parent/child`), to preserve the parent page?
If this request is possible and coherent with the ion-tabs design, I am thinking of something like:
- Detect the url that is attributed to the default page: `/tabs/parent`
- Load the ParentPage and place it under the ion-tabs
- Load the child page besides the parent page, this way the parent page will always remain when navigating to/from it.
**Related Code**
Please refer to [this stackblitz sample](https://stackblitz.com/edit/ionic-v4-angular-v8-navigateback-refreshprblm)
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Start by running the linked StackBlitz sample, ionic-v4-angular-v8-navigateback-refreshprblm, and reproduce navigation from /tabs/parent/child back to /tabs/parent and forward again. Inspect the ion-tabs and ion-router-outlet navigation behavior; done means the default parent page remains mounted after a reload on the child page and subsequent navigation.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- angular, typescript
- Ambito
- frontend, mobile-dev
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100