Skip to content

introduce a way to inspect shadow node revision in Fantom#51566

Closed
sammy-SC wants to merge 1 commit into
facebook:mainfrom
sammy-SC:export-D75287261
Closed

introduce a way to inspect shadow node revision in Fantom#51566
sammy-SC wants to merge 1 commit into
facebook:mainfrom
sammy-SC:export-D75287261

Conversation

@sammy-SC
Copy link
Copy Markdown
Contributor

Summary:
changelog: [internal]

Expose revision of shadow node in Fantom tests. This makes it possible to write tests verifying that shadow nodes are only cloned when they should.

Even though excessive cloning does not usually lead to bugs, it may lead to performance problems.

Also introduce a test showing a performance problem where changing height of "Sibling" view from 1 to 2 will lead to component D being cloned by Yoga. Component D is not affected by the size change of Sibling and the clone is unnecessary.

<ScrollView>
  <View id="Sibling" style={{ height: 1 }} />
  <View id="A">
    <View id="B">
      <View id="C">
        <View id="D" ref={ref} />
      </View>
    </View>
  </View>
</ScrollView>

Reviewed By: rshest

Differential Revision: D75287261

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels May 23, 2025
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D75287261

…1566)

Summary:
Pull Request resolved: facebook#51566

changelog: [internal]

Expose [revision](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.h#L229) of shadow node in Fantom tests. This makes it possible to write tests verifying that shadow nodes are only cloned when they should.

Even though excessive cloning does not usually lead to bugs, it may lead to performance problems.

Also introduce a test showing a performance problem where changing height of "Sibling" view from 1 to 2 will lead to component `D` being cloned by Yoga. Component D is not affected by the size change of Sibling and the clone is unnecessary.

```jsx
<ScrollView>
  <View id="Sibling" style={{ height: 1 }} />
  <View id="A">
    <View id="B">
      <View id="C">
        <View id="D" ref={ref} />
      </View>
    </View>
  </View>
</ScrollView>
```

Reviewed By: rshest

Differential Revision: D75287261
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D75287261

@sammy-SC sammy-SC force-pushed the export-D75287261 branch from 038202c to 46f6f3a Compare May 24, 2025 21:16
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label May 24, 2025
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in afb5436.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @sammy-SC in afb5436

When will my fix make it into a release? | How to file a pick request?

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants