Fix Fabric reusing nodes with a stale font scale (#57246)#57246
Open
j-piasecki wants to merge 1 commit into
Open
Fix Fabric reusing nodes with a stale font scale (#57246)#57246j-piasecki wants to merge 1 commit into
j-piasecki wants to merge 1 commit into
Conversation
|
@j-piasecki has imported this pull request. If you are a Meta employee, you can view this in D108877387. |
Summary: Fixes react#52895 The original solution to this issue approached this by comparing the font scale used to lay out respective root nodes and re-cloning measurable nodes in the entire tree when it was different. This didn't work when a node within the tree was cloned from a node with an obsolete font scale stored (with root having the correct one). The new node would use the obsolete value in that pass. This PR changes this approach - instead of comparing font scale in `SurfaceHandler::constraintLayout` (only when it changes), it moves the comparison to happen as part of `configureYogaTree`, similarly to `pointScaleFactor`. This way, nodes with an obsolete value stored get re-cloned using the correct one on each commit instead of only on the first one. ## Changelog: [GENERAL][FIXED] - Fixed Fabric reusing nodes with a stale font scale Test Plan: Issue reproducer ||Before|After| |-|-|-| |Android|<video src="https://github.com/user-attachments/assets/0b30ca95-76e9-4ce9-8d8f-418f9d827bea" />|<video src="https://github.com/user-attachments/assets/009be13c-c3b5-4af0-8be1-b44c94ac0496" />| |iOS|<video src="https://github.com/user-attachments/assets/b861b622-a2ea-4cc4-a8db-0e3ad4cae5e7" />|<video src="https://github.com/user-attachments/assets/ec4d6f6e-7558-4430-813b-61a6e911c3b0" />| Differential Revision: D108877387 Pulled By: j-piasecki
2454c01 to
bcabdf3
Compare
|
@j-piasecki has exported this pull request. If you are a Meta employee, you can view the originating Diff in D108877387. |
chrfalch
reviewed
Jun 17, 2026
|
|
||
| if (child.yogaTreeHasBeenConfigured_ && | ||
| childLayoutMetrics.pointScaleFactor == pointScaleFactor && | ||
| childLayoutMetrics.fontSizeMultiplier == fontSizeMultiplier && |
Collaborator
There was a problem hiding this comment.
Should we use the floatEquality test here as well - just for consistency?
Suggested change
| childLayoutMetrics.fontSizeMultiplier == fontSizeMultiplier && | |
| floatEquality(childLayoutMetrics.fontSizeMultiplier == fontSizeMultiplier) && |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Fixes #52895
The original solution to this issue approached this by comparing the font scale used to lay out respective root nodes and re-cloning measurable nodes in the entire tree when it was different. This didn't work when a node within the tree was cloned from a node with an obsolete font scale stored (with root having the correct one). The new node would use the obsolete value in that pass.
This PR changes this approach - instead of comparing font scale in
SurfaceHandler::constraintLayout(only when it changes), it moves the comparison to happen as part ofconfigureYogaTree, similarly topointScaleFactor. This way, nodes with an obsolete value stored get re-cloned using the correct one on each commit instead of only on the first one.Changelog:
[GENERAL][FIXED] - Fixed Fabric reusing nodes with a stale font scale
Test Plan:
Issue reproducer
Screen.Recording.2026-06-10.at.11.18.28.mov
Screen.Recording.2026-06-10.at.11.15.46.mov
Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-06-10.at.11.19.05.mov
Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-06-10.at.11.16.37.mov
Differential Revision: D108877387
Pulled By: j-piasecki