-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
ionViewCanLeave lifecycle hook on Tabs page - error with ion-segments #9392
Comments
@kelvindart can you quickly provide a plunker that reproduces the issue? |
Hi @manucorporat, Plunker created here: http://plnkr.co/edit/QB4vcaQuIhKLYXSgyGvl?p=preview. Steps to replicate:
Let me know if you require any more info! Thanks. |
@kelvindart thanks! |
Hey @manucorporat - apologies for that. The link has been updated (http://plnkr.co/edit/QB4vcaQuIhKLYXSgyGvl?p=preview for convenience sake). |
Hey @manucorporat - just curious, did you manage to replicate this? I understand you're busy, so just a question in passing. |
@kelvindart yes! I can reproduce it, looking into it! Thanks again for the plunker! |
Legend. |
The current selected tab should NOT be deselected (i.e. detached from change detection) if the selected tab does not have a root ie. a tab that acts as a button to open a modal, logout etc. Lifecycle events should not be dispatched either. Right now we are dispatching willLeave/willEnter always (this is a bug). fixes ionic-team#9392
@kelvindart I have one fix: #9512 |
Hi @manucorporat - that's awesome! Thank you very much :) |
Ah I see the problem - it's because clicking the "Logout" tab was then setting the selected tab to that tab, although we're never actually selecting/activating it? |
@kelvindart yeah kind of, it was detaching the current tab from ng2 change detection |
Hey Manu, I noticed this had the rc.5 tag removed. Will it not be included in the next release? Is there anything I can do to assist? |
The current selected tab should NOT be deselected (i.e. detached from change detection) if the selected tab does not have a root ie. a tab that acts as a button to open a modal, logout etc. Lifecycle events should not be dispatched either. Right now we are dispatching willLeave/willEnter always (this is a bug). Closes #9392. Closes #9811. Closes #9392.
This should be fixed in the next release. To test it sooner, please install the latest nightly:
Let us know if you see any issues. Thanks! 😄 |
Hey @brandyscarney - that's awesome, thank you very much! I will give it a spin later today and report back my results. |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Ionic version: (check one with "x")
[ ] 1.x
[x] 2.x
I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
I believe this to be a bug, although you may correct me if I am wrong: using an
ionViewCanLeave()
lifecycle hook on a tabs page which implementsion-segment
s seems to cause theion-segment-button
s to stop operating after rejecting the promise.E.g. I have a tab button hooked up to a logout button with an ionSelect implemented. This ionSelect fires my logout logic (which pops the page). After tapping "No" to confirm if I want to log out, the ion-segment seems to be inoperable.
This seems to be the case when the hook is implemented on the main tabs TypeScript file.
Expected behavior:
For the
ion-segment
to continue working, after rejecting the promise returned in ionViewCanLeave.Steps to reproduce:
mkdir www
so Ionic/Cordova recognises it as a Cordova project.npm install
.ionic serve
.[ngSwitch]
does not operate.Related code:
Other information:
N/A
Ionic info: (run
ionic info
from a terminal/cmd prompt and paste output below):The text was updated successfully, but these errors were encountered: