csharpfritz / csharpfritz/MauiWorkshop
Pages/ViewModel Lifecycle
- Dominant language
- C#
- Stars
- 47
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/csharpfritz/MauiWorkshop/blob/155283ecb14e12968cb677252514aead83b863b7/src/MyNewsReader/MauiProgram.cs#L38
I repeatedly see customers tripping on issues due to keeping pages in memory even after the page is removed from a navigation stack. If a page is truly "single" because it sits at the bottom of the navigation stack like a mainpage/tabbedpage, it will make no difference if the page is transient or singleton. It will already be pinned. However, when it comes to something like an entry form, you don't want state like that hanging around. I've seen users writing custom (and sometimes long) "Clear" methods.
For your app, the use of singleton works, but since this is a workshop and you're educating users, I wanted to raise this as a potential point. Users will keep "swinging the hammer" on using singleton where most often - it is not valid in big applications.
Would like to hear your thoughts on this. Happy to submit a PR if you see value in this.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.