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

[react-interactions] Expose host instance to Scope Query function #17341

Merged
merged 1 commit into from
Nov 11, 2019

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Nov 11, 2019

This PR is a follow up from #17293. Specifically, we added a 2nd argument to the queryAllNodes Scope API. After some internal profiling, I noticed that this pushed engineers towards doing extra work after the query scope, which was a waste of CPU cycles.

To avoid doing extra work, this PR changes the API so that we now pass through the host instance to the query function. That means not only does the query function get the previously existing type and props, but it also gets a third argument instance. In the case of ReactDOM, this will be the DOM element instance.

This then allows for more precise querying of the scope without having to do wasted work after – it can be done as part of the query.

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit ac263bf:

Sandbox Source
heuristic-oskar-3vu22 Configuration

@sizebot
Copy link

sizebot commented Nov 11, 2019

No significant bundle size changes to report.

Size changes (experimental)

Generated by 🚫 dangerJS against ac263bf

@sizebot
Copy link

sizebot commented Nov 11, 2019

No significant bundle size changes to report.

Size changes (stable)

Generated by 🚫 dangerJS against ac263bf

@trueadm
Copy link
Contributor Author

trueadm commented Nov 11, 2019

@tatermelon CC for review.

@trueadm trueadm merged commit 6cff70a into facebook:master Nov 11, 2019
@trueadm trueadm deleted the revise-scope-query branch November 11, 2019 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants