Data: Allow passing store definitions to controls#34170
Merged
Conversation
7 tasks
|
Size Change: -19 B (0%) Total Size: 1.04 MB
ℹ️ View Unchanged
|
142c1ea to
2c1136a
Compare
youknowriad
reviewed
Aug 19, 2021
| function select( storeNameOrDefinition, selectorName, ...args ) { | ||
| return { | ||
| type: SELECT, | ||
| storeKey: isObject( storeNameOrDefinition ) |
Contributor
There was a problem hiding this comment.
Potentially this check could be moved to the implementation of the control itself. Actually, I wonder if it's needed at all since this should just call registry.select which handles both already right? (same for the others)
Member
Author
There was a problem hiding this comment.
You are probably correct. There are some levels of indirection here so I would have to do a second pass of refactorings. I will merge this PR and open another one. I suspect that some unit tests will have to be revised so they work with storeKey as an object. I also wasn't sure if I can update storeKey key.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related to #34155.
Follow-up for #27548.
Updates data controls to accept a data store definition as their first param in addition to a string-based store name value. It aligns with the changes introduced in #27548 and is mostly for consistency.
Updated methods that can be imported from
@wordpress.datawith:selectresolveSelectdispatchHow has this been tested?
Unit and e2e tests should still pass.
Types of changes
API enahcnement for
@wordpress/dataand controls.Checklist:
*.native.jsfiles for terms that need renaming or removal).