Skip to content

Pass the source revision to shouldNewRevisionDirtyMeasurement - #60581

Open
YevheniiKotyrlo wants to merge 1 commit into
react:mainfrom
YevheniiKotyrlo:fix/complete-clone-source-revision
Open

YevheniiKotyrlo wants to merge 1 commit into
react:mainfrom
YevheniiKotyrlo:fix/complete-clone-source-revision

Conversation

@YevheniiKotyrlo

@YevheniiKotyrlo YevheniiKotyrlo commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

YogaLayoutableShadowNode::completeClone() calls shouldNewRevisionDirtyMeasurement(*this, fragment), so the virtual's sourceShadowNode parameter receives the new revision rather than the node it was cloned from (YogaLayoutableShadowNode.cpp#L160-L169). An override that compares the new revision with its source compares the clone with itself, so it finds no difference. react-native-plain-text's override originally did, and changing the font size left every label at its old size until it moved the comparison into its clone constructor (performance.md#L608-L616).

This passes completeClone()'s own sourceShadowNode. ParagraphShadowNode's override ignores the parameter, and FontScaledShadowNode's in ViewTest forwards it to the base implementation, which ignores it, so neither changes.

Related: #60583 changes the condition beside this call in completeClone(); #60571 adds enableBaseline(), #60572 adds getLayoutMargins() and #60578 corrects enableMeasurement()'s comment, all in YogaLayoutableShadowNode; #59048 and #59139 add tests to ViewTest.cpp. This change applies onto each of them without conflict.

Changelog:

[GENERAL] [FIXED] - Pass the source revision, not the clone, to YogaLayoutableShadowNode::shouldNewRevisionDirtyMeasurement()

Test Plan:

Added ViewTest.completeCloneAsksWhetherToDirtyAgainstTheSourceRevision: a measurable leaf whose override dirties when the source's props differ from the clone's. Once laid out, a clone with the source's props stays clean, and a clone with new non-layout props, which leave the Yoga style unchanged, is dirty. Without the fix the second clone stays clean and the case fails.

In reactnativecommunity/react-native-android:latest, with clang 18 as test_react_common_cxx builds:

  • CC=clang-18 CXX=clang++-18 ./gradlew :private:react-native-fantom:configureFantomTester, cmake --build private/react-native-fantom/build/tester --target react_renderer_components_view_tests, then ctest --test-dir private/react-native-fantom/build/tester/react-common-tests -R '^react/renderer/components/view/tests/': 100% tests passed, 0 tests failed out of 113
  • The same on main with only the test applied, -R naming the new case: it fails at its last assertion:
ViewTest.cpp:904: Failure
Value of: static_cast<const YogaLayoutableShadowNode&>(*cloneWithNewProps) .getIsLayoutClean()
  Actual: true
Expected: false
  • clang-format --dry-run --Werror 23.1.4 on both files: no changes

Not run here: the full test_react_common_cxx job, format with its pinned clang-format, validate_cxx_api_snapshots (no header changes), and the Android, iOS and Fantom builds.

@YevheniiKotyrlo
YevheniiKotyrlo force-pushed the fix/complete-clone-source-revision branch from 2627616 to 07e9679 Compare December 4, 2026 22:50
`YogaLayoutableShadowNode::completeClone()` passed the clone itself as the
`sourceShadowNode` argument, so an override comparing the new revision with
its source compared the clone with itself and found no difference.

Signed-off-by: YevheniiKotyrlo <44449990+YevheniiKotyrlo@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Meta Review Required This PR is considered risky and requires Meta to import it to do more testing before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant