Fix Hot Reload with Popup#1635
Merged
TheCodeTraveler merged 7 commits intoCommunityToolkit:mainfrom Feb 17, 2024
Merged
Conversation
Call AddLogicalChild/RemoveLogicalChild when the popup is shown/closed so that popups are included in the logical (and visual) tree, so that Hot Reload works for them. The Live Visual Tree VS UI now shows popup content as well. Fixes CommunityToolkit#620 As Shane explained to me, the rule as of MAUI in .NET8 is that whenenever Parent is set on an Element, AddLogicalChild should also be called to include the element in the logical children. RemoveLogicalChild should be called when the Parent is set to null. This may be more automatic in .NET9, but for .NET8 that's what's needed so that the logical tree is kept up to date.
1 task
Shane pointed out that Add/RemoveLogicalChild also updates the parent, so there's no need for our code to do that as well.
PureWeen
reviewed
Jan 4, 2024
VladislavAntonyuk
approved these changes
Feb 8, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
Call
AddLogicalChild/RemoveLogicalChildwhen the popup is shown/closed so that popups are included in the logical (and visual) tree, so that Hot Reload works for them. The Live Visual Tree VS UI now shows popup content as well.As Shane explained to me, the rule as of MAUI in .NET8 is that whenever
Parentis set on anElementcurrently,AddLogicalChildshould be called on the new parent instead.AddLogicalChildtakes care of both updating the children and parent, whereas updating theParentonly updates the parent not children (and will likely be deprecated). Likewise,RemoveLogicalChildshould be called when the Parent is set to null currently.Linked Issues
Fixes #620
PR Checklist
approved(bug) orChampioned(feature/proposal)mainat time of PRAdditional information