Skip to content

[react-interactions] Modify Scope query mechanism#17095

Merged
trueadm merged 1 commit into
react:masterfrom
trueadm:scope-api-change
Oct 15, 2019
Merged

[react-interactions] Modify Scope query mechanism#17095
trueadm merged 1 commit into
react:masterfrom
trueadm:scope-api-change

Conversation

@trueadm

@trueadm trueadm commented Oct 15, 2019

Copy link
Copy Markdown
Contributor

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

sizebot commented Oct 15, 2019

Copy link
Copy Markdown

No significant bundle size changes to report.

Generated by 🚫 dangerJS against 3b797ed

@trueadm trueadm merged commit 4cb399a into react: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