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

Offen
#20,372 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
package: angular type: bug
Vorherrschende Sprache
TypeScript
Sterne
52.7k
Forks
13.3k
Ø Merge
1 T. 15 Std.
Gemergte PRs (30 T.)
51

Beschreibung

# 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`:
![without-child-reload](https://user-images.githubusercontent.com/15088185/73733254-86482280-4733-11ea-9556-33fb70edcc5c.png)
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:
![with-child-reload](https://user-images.githubusercontent.com/15088185/73733344-b7285780-4733-11ea-851e-be366a2d3b2f.png)
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)

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.