You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Undocumented breaking changes with Popup v2... #2792
In the hopes of 12.1.0 fixes all the issues with Popup v2, a new major breaking change is part of it... OnAppearing and OnDisappearing are now called on the page when opening a popup... Why is stuff like this not documented? Just wasted multiple hours only to find it is from this update...
For whatever reason the popup now triggers these methods, it means that I have to rewrite a huge part of my app because I usually register/unregister events there... But popups that change data of the page behind it are now impossible to use for it...
Expected Behavior
Not calling OnDisappearing/OnDisappearing of the actual page that is "hosting" the popup...
Hi, I also noticed this problem.
Unlike V1, the Popup V2 implementation calls the OnAppearing on the underlying page when you close the popup.
This leads to malfunctions in my app, because if I open a popup in the OnAppearing event and then I close it, the execution flow breaks and another call to OnAppearing is made.
If it needs to be so, I have to redesign huge code in my app.
Can you simply remove the unnecessary call to OnAppearing when closing the Popup?
To verify this, you can open CommunityToolkit_2703_repro, override OnAppearing on the MainPage and add Console.WriteLine("On appearing hit"); after base.OnAppearing();
@CyberZeus we cannot remove this because it is .NET MAUI calling it and not the toolkit. I happens because a popup is now displayed in a modal ContentPage.
I will add to the documentation and also have a PR that should help to make changes around this easier if you are using OnNavigatedTo which may be a better option instead of OnAppearing
@CyberZeus we cannot remove this because it is .NET MAUI calling it and not the toolkit. I happens because a popup is now displayed in a modal ContentPage.
I will add to the documentation and also have a PR that should help to make changes around this easier if you are using OnNavigatedTo which may be a better option instead of OnAppearing
Thank you, I understand this, now, popup is a modal ContentPage.
I prefer Popup V1, I was able to implement it very quickly, but now with V2 I see more problems than benefits.
By the way, don't know how to solve, both OnAppearing and OnNavigatedTo are called when I close the popup.
@CyberZeus we cannot remove this because it is .NET MAUI calling it and not the toolkit. I happens because a popup is now displayed in a modal ContentPage.
I will add to the documentation and also have a PR that should help to make changes around this easier if you are using OnNavigatedTo which may be a better option instead of OnAppearing
Thank you, I understand this, now, popup is a modal ContentPage. I prefer Popup V1, I was able to implement it very quickly, but now with V2 I see more problems than benefits.
By the way, don't know how to solve, both OnAppearing and OnNavigatedTo are called when I close the popup.
I appreciate it is a different way of doing things and it brings in its own behavioural differences - we had to make a move away from the original implementation because we had to fight with so many layout bugs that we felt it was best to rely on something .NET MAUI does well.
For the OnNavigatedTo implementation it will become a lot easier once this PR #2767 merges but for the interim you could store whether you have navigated to the page already in a bool and return early if true. Then hopefully once this PR is in it could be cleaner - I would like to extend this further but I need to work out how first.
I have created this page that explains a little on the impact of showing/closing a Popup MicrosoftDocs/CommunityToolkit#578 I would really appreciate the community getting involved and letting me know if it needs more - it is difficult to lose the context and write it without knowing how it works so any extra input people can give would really help.
@bijington Thank you!
Because closing a Popup opened in OnAppearing event causes loops and code flow breaks (OnAppearing continously hits and opens the same popup), I had to refactor my app and avoid opening popups on OnAppearing.
Activity
VladislavAntonyuk commentedon Jul 5, 2025
Popup is a "transparent" page that uses navigation, so your initial page will call OnAppearing / on disappearing.
Sebastian1989101 commentedon Jul 5, 2025
That was not the behavior on v1 and it is still not listed as breaking change even tho it is exactly that.
bijington commentedon Jul 5, 2025
Thanks for highlighting this. I'll put something into the docs pages
CyberZeus commentedon Jul 7, 2025
Hi, I also noticed this problem.
Unlike V1, the Popup V2 implementation calls the OnAppearing on the underlying page when you close the popup.
This leads to malfunctions in my app, because if I open a popup in the OnAppearing event and then I close it, the execution flow breaks and another call to OnAppearing is made.
If it needs to be so, I have to redesign huge code in my app.
Can you simply remove the unnecessary call to OnAppearing when closing the Popup?
To verify this, you can open CommunityToolkit_2703_repro, override OnAppearing on the MainPage and add Console.WriteLine("On appearing hit"); after base.OnAppearing();
https://github.com/mfeingol/repros/tree/master/CommunityToolkit_2703_repro
You'll see that OnAppearing, unlike V1, is called when you close the popup.
bijington commentedon Jul 7, 2025
@CyberZeus we cannot remove this because it is .NET MAUI calling it and not the toolkit. I happens because a popup is now displayed in a modal ContentPage.
I will add to the documentation and also have a PR that should help to make changes around this easier if you are using
OnNavigatedTowhich may be a better option instead ofOnAppearingCyberZeus commentedon Jul 7, 2025
Thank you, I understand this, now, popup is a modal ContentPage.
I prefer Popup V1, I was able to implement it very quickly, but now with V2 I see more problems than benefits.
By the way, don't know how to solve, both OnAppearing and OnNavigatedTo are called when I close the popup.
bijington commentedon Jul 7, 2025
I appreciate it is a different way of doing things and it brings in its own behavioural differences - we had to make a move away from the original implementation because we had to fight with so many layout bugs that we felt it was best to rely on something .NET MAUI does well.
For the
OnNavigatedToimplementation it will become a lot easier once this PR #2767 merges but for the interim you could store whether you have navigated to the page already in abooland return early iftrue. Then hopefully once this PR is in it could be cleaner - I would like to extend this further but I need to work out how first.bijington commentedon Jul 7, 2025
I have created this page that explains a little on the impact of showing/closing a Popup MicrosoftDocs/CommunityToolkit#578 I would really appreciate the community getting involved and letting me know if it needs more - it is difficult to lose the context and write it without knowing how it works so any extra input people can give would really help.
CyberZeus commentedon Jul 8, 2025
@bijington Thank you!
Because closing a Popup opened in OnAppearing event causes loops and code flow breaks (OnAppearing continously hits and opens the same popup), I had to refactor my app and avoid opening popups on OnAppearing.
bijington commentedon Jul 9, 2025
I'm closing this issue as we have the docs PR open