-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 fix] Fixed a bug where MarkdownTextBlock loses all events after … #3180
[Bug fix] Fixed a bug where MarkdownTextBlock loses all events after … #3180
Conversation
…re-load [Bug fix] Fixed a bug where MarkdownTextBlock loses all events after re-load. Issue is described here: 0x7c13/Notepads#377
Thanks JasonStein for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌 |
@michael-hawker I accidentally closed it, can you help re-open this PR again? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, thanks!
Microsoft.Toolkit.Uwp.UI.Controls/MarkdownTextBlock/MarkdownTextBlock.Methods.cs
Show resolved
Hide resolved
Unhook event before assigning to make sure no duplicate
This PR has been marked as "needs attention 👋" and awaiting a response from the team. |
Should be ready to go, any comments guys? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this @Jasonstein this was a great fix!
Fixes
Fixed a bug where MarkdownTextBlock loses all events after page re-load. Issue is described here: 0x7c13/Notepads#377
The root cause here is that we should not clear all existing events onUnloaded since page might be reloaded in the future since Unloaded != Dispose. Instead of unhook events and clear references, we should just unhook the events during page unload and re-hook everything back if it reloads. Since we have all the events already unhooked in Unload event, we should expect GC to kicks in at certain point if MarkdownTextBlock never reload again in the future. So we are fine of keeping the event references here.
PR Type
Bugfix
What is the current behavior?
MarkdownTextBlock loses all events after re-load.
What is the new behavior?
MarkdownTextBlock should keep all existing events after page re-load.
PR Checklist
Please check if your PR fulfills the following requirements: