Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Closing select dialog triggers onPageWillEnter #5516

Closed
danbucholtz opened this issue Feb 18, 2016 · 5 comments
Closed

bug: Closing select dialog triggers onPageWillEnter #5516

danbucholtz opened this issue Feb 18, 2016 · 5 comments
Assignees
Milestone

Comments

@danbucholtz
Copy link
Contributor

Type: bug

Ionic Version: 2.x

Platform: all

I have an @page component with a form. I am using the ion-select component. After I make my selection and close the dialogue, it calls onPageWillEnter again. This seems like a bug to me.

It is very easy to reproduce. If you need code I can give you code. This is with beta1 npm module.

@alexbainbridge
Copy link

On a similar point, I have onPageWillEnter firing after closing an alert. Not sure if that is as designed, caught me out for a while

@adamdbradley
Copy link
Contributor

Ok, I think I see the problem, where when a modal/alert/actionsheet is technically another page that loaded in the nav stack, and when it's removed then the page before it "entered" again. For sure the ion-select probably shouldn't do this, since conceptually it's apart of the page. That's also debatable for alert and actionsheet. However, for modal the previous page should onPageWillEnter. I'll add it to beta2 and take a look, thanks.

@adamdbradley adamdbradley added this to the 2.0.0-beta.2 milestone Feb 19, 2016
@danbucholtz
Copy link
Contributor Author

From my perspective, an Alert is just an alert, not a page. I guess I view the new alert as a replacement for Window.alert to make it look pretty.

I guess I view it as fundamentally different than a Modal, where my Modal does take a Page component as a parameter and display that. When I close a Modal, I would expect the underlying page's onPageWillEnter to be called.

It's interesting though - I am not so sure I would feel that way in a master/detail view, so iPad or decent sized browser. It may be worth looking at what Cocoa Touch does and when it calls viewWillAppear.

@alexbainbridge
Copy link

If not too onerous, that leads to a thought - perhaps have onViewWillEnter for a view entry event (including after closing alerts, actionsheets, selects), and onPageWillEnter for where its a page, with a page constructor (i.e. excluding alerts, actionsheets, selects)

That way, we can use the one we want, depending upon circumstances

adamdbradley added a commit that referenced this issue Feb 19, 2016
For Alert and ActionSheet, the currently active page’s leaving
lifecycle event should not fire. However, for Modal, the currently
active page’s leaving lifecycle should fire. Closes #5516
@adamdbradley
Copy link
Contributor

Awesome thanks for the issue, I think this is a good update. So now alerts, actionsheets and ion-selects, won't fire the active page's lifecycle events. Thanks!

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants