Only Generate ShadowGroups When Needed
#1748
Draft
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.
This is work towards #1740 - it doesn't fix the issue, but it attempts to minimize the number of
ShadowGroupinstances being created by just using theGroupdirectly when it is OK to do so.A
ShadowGroupis needed in situations where the content of theGroupas instantiated in the UI is not the same as the content of theGroupas defined by the user. There are 4 ways this can happen:Groupwhich has adefined_whenthat evaluates toFalse(and so must be hidden)Grouphas one or moreIncludeelementsShadowGroupfor the above 2 reasonsItemandGroupelements, runs ofItemelements are wrapped inShadowGroupinstances so that the layout algorithm only deals with all-item or all-group layout casesOther than the last, these are not common; and the last example does not "propagate" because it is computed on an as-needed basis during UI creation, so it is somewhat contained.
This is a behavioural change, however, as using the
Groupdirectly means that any trait changes on theGroupaffect all views and UIs which are using that groups (theShadowGroupclass instead prototype the traits, so changes only go in one direction).Checklist
Note: opening this as a draft, as not sure whether this is 100% OK, given the behaviour change (or if the behaviour change is OK, whether we can push it further).