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
ShadowGroup
instances being created by just using theGroup
directly when it is OK to do so.A
ShadowGroup
is needed in situations where the content of theGroup
as instantiated in the UI is not the same as the content of theGroup
as defined by the user. There are 4 ways this can happen:Group
which has adefined_when
that evaluates toFalse
(and so must be hidden)Group
has one or moreInclude
elementsShadowGroup
for the above 2 reasonsItem
andGroup
elements, runs ofItem
elements are wrapped inShadowGroup
instances 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
Group
directly means that any trait changes on theGroup
affect all views and UIs which are using that groups (theShadowGroup
class 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).