Skip to content
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

Add config version, and invalidate layout on config change #1674

Closed
wants to merge 3 commits into from

Conversation

acoates-ms
Copy link
Contributor

This is a continuation of the previous PR: facebook/react-native#45047

I made the change more generic for allowing any kind of config change to invalidate layout.

Copy link

vercel bot commented Jul 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
yoga-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2024 2:22pm

@facebook-github-bot facebook-github-bot added CLA Signed Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Jul 1, 2024
Copy link
Contributor

@NickGerleman NickGerleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

@NickGerleman NickGerleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@facebook-github-bot
Copy link
Contributor

@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

NickGerleman pushed a commit to NickGerleman/react-native that referenced this pull request Jul 2, 2024
Summary:
This is a continuation of the previous PR: facebook#45047

I made the change more generic for allowing any kind of config change to invalidate layout.

X-link: facebook/yoga#1674

Differential Revision: D59286992

Pulled By: NickGerleman
NickGerleman pushed a commit to NickGerleman/react-native that referenced this pull request Jul 3, 2024
…45259)

Summary:
Pull Request resolved: facebook#45259

This is a continuation of the previous PR: facebook#45047

I made the change more generic for allowing any kind of config change to invalidate layout.

X-link: facebook/yoga#1674

Reviewed By: rozele

Differential Revision: D59286992

Pulled By: NickGerleman
NickGerleman pushed a commit to NickGerleman/yoga that referenced this pull request Jul 3, 2024
…1674)

Summary:
This is a continuation of the previous PR: facebook/react-native#45047

I made the change more generic for allowing any kind of config change to invalidate layout.

Pull Request resolved: facebook#1674

Differential Revision: D59286992

Pulled By: NickGerleman
facebook-github-bot pushed a commit to facebook/litho that referenced this pull request Jul 3, 2024
Summary:
X-link: facebook/react-native#45259

This is a continuation of the previous PR: facebook/react-native#45047

I made the change more generic for allowing any kind of config change to invalidate layout.

Changelog: [Internal]

X-link: facebook/yoga#1674

Reviewed By: rozele

Differential Revision: D59286992

Pulled By: NickGerleman

fbshipit-source-id: f46f35b03d5d9a743b798844ee3e1a02c271ccde
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Jul 3, 2024
Summary:
Pull Request resolved: #45259

This is a continuation of the previous PR: #45047

I made the change more generic for allowing any kind of config change to invalidate layout.

Changelog: [Internal]

X-link: facebook/yoga#1674

Reviewed By: rozele

Differential Revision: D59286992

Pulled By: NickGerleman

fbshipit-source-id: f46f35b03d5d9a743b798844ee3e1a02c271ccde
@facebook-github-bot
Copy link
Contributor

@NickGerleman merged this pull request in e4fe14a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Merged Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants