Skip to content

Commit

Permalink
Only expose the select function in registry selectors (#13889)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad authored Feb 15, 2019
1 parent 858719b commit af68f20
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
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

0 comments on commit af68f20

Please sign in to comment.