Add config version, and invalidate layout on config change #1674
Reference in New Issue
Block a user
No description provided.
Delete Branch "configversion"
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?
This is a continuation of the previous PR: https://github.com/facebook/react-native/pull/45047
I made the change more generic for allowing any kind of config change to invalidate layout.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
This looks good! But I think it introduces subtle bug that breaks layout caching in Fabric, around assigning new config to already created node.
In current Fabric impl, we lazily clone any committed ShadowNodes when we know we may need to write new layout information to them. This currently means new inline Yoga node and Yoga config in the ShadowNode. The new config is associated with cloned node via
YGNodeSetConfig
, and right now this only dirties the node if meaningful config values have changed.After this change, if we have new config, derived from previous one, they may be structurally equal, but have a different revision count. So the process of building new config, derived from previous, may still lead to invalidation. Or, in the reverse, a config revision ID is no longer valid if a new config is assigned, and we should clear it (though we do dirty anyways).
I think, we can address this, by adding code around the existing equality check (IIRC in
Node::setConfig()
), to update kept revision ID to match new config revision ID if they are equal, or clear if not.LGTM
@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@NickGerleman merged this pull request in facebook/yoga@e4fe14ab3e.
Pull request closed