ionic-team / ionic-team/ionic-framework

Lifecycle events called in wrong order

Open
#17,373 4 comments 5 reactions 0 assignees View on GitHub
package: angular type: bug
Dominant language
TypeScript
Stars
52.7k
Forks
13.3k
Avg merge
1d 15h
Merged PRs (30d)
51

Description

# Bug Report

**Ionic version:**
[x] **4.0.0**

**Current behavior:**
When changing the root page the lifecycle events of the previous and next page seem to fire out of order. So, lets say page A is currently displayed. Navigating to page B fires the lifecycle events in the following order:
1. Page B: ngOnInit
2. Page B: ionViewWillEnter
3. Page B: ionViewDidEnter
4. Page A: ngOnDestroy

(ionViewWillLeave and ionViewDidLeave do not fire at all)

**Expected behavior:**
I would expect that page A fires ngOnDestroy or ionViewWillLeave or ionViewDidLeave before page B's 'enter' events

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.