WIP: Fix missing invalidation if owner has undefined dimensions #1017
Reference in New Issue
Block a user
No description provided.
Delete Branch "woehrl01/fix-invalidate-owner-size"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #1003 by adding additional values, which keep track if the owner size has been undefined before. Being undefined lead to different calculations for min/max constraints thus, in that specific case leading to the wrong behavior.
Please also see my concerns posted in the issue.
Would similar issue also happen when owner size changes from one defined size to another?
It should also work in that case. As the missing parent size leads to not taking min/max values into account. I'll have a second look later, maybe we have a different fix, without the new variables here, too. Until then I'll keep this PR as draft. The alternative as described in the issue is still the best approach for now.
Hey @woehrl01, I think we want to import this, and think it might supersede the current code for
YGUseExperimentalWebFlexBasis
. @rozele root-caused a long-running issue in an app we care about to this issue #1161.We're more generally looking to start migrating the React Native ecosystem off of legacy incorrect behaviors, but I think we should put this behind a flag. That way we can experiment, to know if it will be a breaking change we should leave behind a gate, or if its relatively safe to enable out of the box.
Size impact per-node can be mitigated by embedding into the
flags
bitset I think. We may need to add another byte to it soon. There is also a flag I have been meaning to remove from there (for super expensive whole-tree layout diffing).I can pick this up, but wanted to give a heads up first 🙂.
@NickGerleman it's awesome to see the latest effort you put into the library.
I fully agree on your approach. Feel free to pick this up!
@NickGerleman I just had a closer look into the current layout of the
YGLayout
struct. I think you can put those two additional flags also into the following position by replacinglastOwnerDirection
with a flag, similar todirectionOffset
+didUseLegacyFlagOffset
. This would be even nicer as you have one field for flags and the other field for storing latest layout conditions. This won't change the per node size.@woehrl01 does this bug also happen if
padding
orborderWidth
were set to undefined - or is it just width and height?@jacobp100 Are you talking about
padding
orborderWidth
on the owner? This fix is mainly if the root owner changes, where you usually can't set those properties at all. If you modifypadding
on a child item, thedirty
flag is set and gets propagated. Do you have a specific issue/test case?No - I was just wondering. It just seemed strange to me that only width/height would trigger this, but not other layout-affecting properties
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.