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

Only expose the select function in registry selectors #13889

Merged
merged 1 commit into from
Feb 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/core-data/src/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import { getQueriedItems } from './queried-data';
*
* @return {boolean} Whether a request is in progress for an embed preview.
*/
export const isRequestingEmbedPreview = createRegistrySelector( ( registry ) => ( state, url ) => {
return registry.select( 'core/data' ).isResolving( REDUCER_KEY, 'getEmbedPreview', [ url ] );
export const isRequestingEmbedPreview = createRegistrySelector( ( select ) => ( state, url ) => {
return select( 'core/data' ).isResolving( REDUCER_KEY, 'getEmbedPreview', [ url ] );
} );

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/data/src/namespace-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function createReduxStore( reducer, key, registry ) {
*/
function mapSelectors( selectors, store, registry ) {
const createStateSelector = ( registeredSelector ) => {
const selector = registeredSelector.isRegistrySelector ? registeredSelector( registry ) : registeredSelector;
const selector = registeredSelector.isRegistrySelector ? registeredSelector( registry.select ) : registeredSelector;

return function runSelector() {
// This function is an optimized implementation of:
Expand Down
4 changes: 2 additions & 2 deletions packages/data/src/test/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,8 @@ describe( 'createRegistry', () => {

it( 'should run the registry selectors properly', () => {
const selector1 = () => 'result1';
const selector2 = createRegistrySelector( ( reg ) => () =>
reg.select( 'reducer1' ).selector1()
const selector2 = createRegistrySelector( ( select ) => () =>
select( 'reducer1' ).selector1()
);
registry.registerStore( 'reducer1', {
reducer: () => 'state1',
Expand Down