-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Data: Create registry selector with self-contained registry proxying #16692
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7bbe1e0
Data: Create registry selector with self-contained registry proxying
aduth 5c3442b
Editor: Fix tests that relied on registry selectors being higher order.
epiqueras 96ab4e0
Data: Add typedef import reference for WPDataRegistry
aduth a559bb2
Data: Omit removed registry argument from mapSelectors
aduth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unclear to me where
selector.registry.select
is coming from as the argument passed toregistrySelector
. Is it supposed to bedefaultRegistry.select
or I'm guessing it will it be whatever is set onselector.registry
at the time it's invoked (with a fallback todefaultRegistry
)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It happens here:
gutenberg/packages/data/src/namespace-store/index.js
Lines 47 to 49 in 4edd1d0
This occurs when a store is registered to a registry, so effectively the default registry is never used. I added it to simplify / respect the
@type
declaration (tangentially related to #16693), but it could just as well be a noop stub.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I wonder if using a noop stub instead might lead to less head scratching for future looks at this code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we stubbed it, I wouldn't feel comfortable adding
@type {WPDataRegistry}
, since it'd be wrong to claim that the stub is of that type (and I expect potential future type checking could flag it as such).I'm leaning that the current comment for
selector.registry
assignment alone could be clear enough to explain its purpose.https://github.com/WordPress/gutenberg/blob/a9e45dc3cdaa7696ac5e686a0ff6fe9eec1f9a5b/packages/data/src/factory.js#L25-L26