-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Remove warning for children in UI hierarchies without Style #15736
Conversation
This fix was much simpler than the more specific UI -> non-UI -> UI pattern that @cart called out as problematic here. I also think it's somewhat better, as non-UI -> UI still has not-particularly well defined behavior in general. We could treat that case as fine if and only if there's no UI root above it by treating it as the start of a new tree, but really that feels quite a bit more complex for users to reason about and will involve a more complex fix and ongoing validity checks. |
Waiting on an opinion from Cart before merging :) I want to make sure that this lines up with what he had in mind. |
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.
This fix was much simpler than the more specific UI -> non-UI -> UI pattern that @cart called out as problematic
Ah yeah this is definitely the right path forward conceptually. It being simpler / just removing code is icing on the cake!
# Objective With the warning removed in #15736, the rules for the UI tree changes. We no longer need to traverse non `Node`/`GhostNode` entities. ## Solution - Added a filter `Or<(With<Node>, With<GhostNode>)>` to the child traversal query so we don't unnecessarily traverse nodes that are not part of the UI tree (like text nodes). - Also moved the warning for NoUI->UI entities so it is actually triggered (see comments) ## Testing - Ran unit tests (still passing) - Ran the ghost_nodes and ui examples, still works and looks fine 👍 - Tested the warning by spawning a Node under an empty entity. --- --------- Co-authored-by: UkoeHB <37489173+UkoeHB@users.noreply.github.com>
Objective
As discussed in #15591, this warning prevents us from storing leaf nodes without a
Style
component. Because text sections (as distinct entities) should not be laid out usingtaffy
, this warning is incorrect.Users may also have other uses for doing this, and this should generally increase flexibility without posing particularly serious correctness concerns.
Solution
taffy
layoutTesting
I inserted an empty entity into the hierarchy in the
button
example as a leaf node, and it ran with no warnings.