-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Improve UiSurface #11423
base: main
Are you sure you want to change the base?
Improve UiSurface #11423
Conversation
Can you make a PR to |
Looks like someone beat me to it: DioxusLabs/taffy#520 |
} | ||
|
||
/// Update the children of the taffy node corresponding to the given [`Entity`]. | ||
pub fn update_children(&mut self, entity: Entity, children: &Children) { | ||
pub fn update_children(&mut self, entity: Entity, children: &Children) -> SurfaceResult<()> { |
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.
I ran into this so many times, thanks for the fix. However, I would like to point out that the panics we get from this is a symptom and not the cause of the issue. Nodes aren't synced well, which leads to the panics and fixing all this might hide the problem altogether, leading to inconsistencies in the visible UI. (I had this when the nodes went out of sync, the layout was all whacky, and when a sub-tree was deleted it crashed.)
Objective
Follow up to #11405.
Solution
This PR contains several improvements to
UiSurface
that will hopefully prevent crashes in the future.I also noticed a lot of Taffy methods that, despite returning
Result
, never actually have an error condition. So I made those.unwrap_unchecked()
.Feel free to nitpick this, I appreciate it.
Changelog
UiSurface
ImprovementsSurfaceError
&SurfaceResult
that will be returned by most methods ofUiSurface
. (Instead of panicking)UiSurface
methods to returnSurfaceResult
.Migration Guide
UiSurface
methods to returnSurfaceResult
.