Skip to content

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.

4 participants