Skip to content

Fix Hot Reload with Popup#1635

Merged
TheCodeTraveler merged 7 commits intoCommunityToolkit:mainfrom
BretJohnson:fix-popup-hot-reload
Feb 17, 2024
Merged

Fix Hot Reload with Popup#1635
TheCodeTraveler merged 7 commits intoCommunityToolkit:mainfrom
BretJohnson:fix-popup-hot-reload

Conversation

@BretJohnson
Copy link
Copy Markdown

@BretJohnson BretJohnson commented Jan 4, 2024

Description of Change

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.

As Shane explained to me, the rule as of MAUI in .NET8 is that whenever Parent is set on an Element currently, AddLogicalChild should be called on the new parent instead. AddLogicalChild takes care of both updating the children and parent, whereas updating the Parent only updates the parent not children (and will likely be deprecated). Likewise, RemoveLogicalChild should be called when the Parent is set to null currently.

Linked Issues

Fixes #620

PR Checklist

Additional information

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.
pictos
pictos previously approved these changes Jan 4, 2024
Copy link
Copy Markdown
Member

@pictos pictos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Shane pointed out that Add/RemoveLogicalChild also updates the parent,
so there's no need for our code to do that as well.
@TheCodeTraveler TheCodeTraveler enabled auto-merge (squash) February 17, 2024 21:33
@TheCodeTraveler TheCodeTraveler merged commit 9628467 into CommunityToolkit:main Feb 17, 2024
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Popup doesn't work with hot reload

5 participants