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] Modify Scope query mechanism #17095

Merged
merged 1 commit into from
Oct 15, 2019

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Oct 15, 2019

This PR changes the mechanism as to which scopes can query for host component descendants in their sub-tree. Specifically, after much internal feedback, the need to provide a query function to a scope when the scope was not to be used for querying felt like a quirk in the API design.

This PR makes it so createScope no longer needs any arguments, rather that the query scope function is provided when the querying is actually executed.

// Before:

const DivScope = React.unstable_createScope(type => type === 'div');
const nodes = divScopeRef.current.getAllNodes();

// After

const DivScope = React.unstable_createScope();
const nodes = divScopeRef.current.queryAllNodes(type => type === 'div');

This PR also renames to TabbableScope module to TabbableScopeQuery to reflect this API change.

@sizebot
Copy link

sizebot commented Oct 15, 2019

No significant bundle size changes to report.

Generated by 🚫 dangerJS against 3b797ed

@trueadm trueadm merged commit 4cb399a into facebook:master Oct 15, 2019
@trueadm trueadm deleted the scope-api-change branch October 15, 2019 13:57
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.

None yet

4 participants