From 2c51bc38575505da10d8b1b442d4c3e00906ddfd Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 15 Feb 2019 11:11:25 +0100 Subject: [PATCH] Only expose the select function in registry selectors --- packages/core-data/src/selectors.js | 4 ++-- packages/data/src/namespace-store.js | 2 +- packages/data/src/test/registry.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/core-data/src/selectors.js b/packages/core-data/src/selectors.js index 36130c3439df65..54f9ba4adbe496 100644 --- a/packages/core-data/src/selectors.js +++ b/packages/core-data/src/selectors.js @@ -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 ] ); } ); /** diff --git a/packages/data/src/namespace-store.js b/packages/data/src/namespace-store.js index bb1259d3c52af5..510e218152e811 100644 --- a/packages/data/src/namespace-store.js +++ b/packages/data/src/namespace-store.js @@ -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: diff --git a/packages/data/src/test/registry.js b/packages/data/src/test/registry.js index e85495240e1f33..752d21dedb721e 100644 --- a/packages/data/src/test/registry.js +++ b/packages/data/src/test/registry.js @@ -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',