Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Page willLeave is called twice #547

Open
ionitron-bot bot opened this issue Nov 29, 2018 · 1 comment
Open

Page willLeave is called twice #547

ionitron-bot bot opened this issue Nov 29, 2018 · 1 comment
Labels

Comments

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 29, 2018

Original issue by @jcviau on 2018-01-27T00:03:20Z

Ionic version: (check one with "x")
(For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[X ] 3.x
[ ] 4.x

I'm submitting a ... (check one with "x")
[X ] bug report
[ ] feature request

Current behavior:
ionViewWillLeave is called twice on a component.

Expected behavior:
ionViewWillLeave should be called only once.

Steps to reproduce:
Root Page A
Push Page B
Push Page C -> WillLeave is called once on Page B
Change Root to Page D -> WillLeave is called again on Page B
,,.

Related code:
this.navCtrl.push(PageB);
this.navCtrl.push(PageC);
this.navCtrl.setRoot(PageD);

Other information:
When we push a page, willLeave is called on the previous active view (and it stays in the stack of pages). Then, when we call setRoot, the method _postViewInit (in nav-controller-base) call willLeave again on the view that it destroys, even if they werent the active view and their willLeave was already called.

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
cli packages: (C:\Users\jeavia1\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.15.2
ionic (Ionic CLI) : 3.15.2

global packages:

cordova (Cordova CLI) : not installed

local packages:

@ionic/app-scripts : 3.1.8
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 25.2.5
Node              : v8.5.0
npm               : 5.4.2
OS                : Windows 10

Environment Variables:

ANDROID_HOME : C:\Program Files (x86)\Android\android-sdk

Misc:

backend : pro
@angelo-italy
Copy link

Hi, any plans to solve it ?
Ionic 3 is still alive ! :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant