Skip to content

Commit

Permalink
map private selectors to resolvers
Browse files Browse the repository at this point in the history
  • Loading branch information
draganescu committed Jun 27, 2023
1 parent 77d7ffc commit 00844b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core-data/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ const storeConfig = () => ( {
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
*/
export const store = createReduxStore( STORE_NAME, storeConfig() );
register( store );
unlock( store ).registerPrivateSelectors( {
getNavigationFallbackId,
} );
register( store ); // Register store after unlocking private selectors to allow resolvers to use them.

export { default as EntityProvider } from './entity-provider';
export * from './entity-provider';
Expand Down
8 changes: 7 additions & 1 deletion packages/data/src/redux-store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function createBindingCache( bind ) {
*/
export default function createReduxStore( key, options ) {
const privateActions = {};
const privateSelectors = {};
let privateSelectors = {};
const privateRegistrationFunctions = {
privateActions,
registerPrivateActions: ( actions ) => {
Expand Down Expand Up @@ -259,6 +259,12 @@ export default function createReduxStore( key, options ) {
store,
resolversCache
);
privateSelectors = mapSelectorsWithResolvers(
privateSelectors,
resolvers,
store,
resolversCache
);
}

const boundPrivateSelectors = createBindingCache( bindSelector );
Expand Down

0 comments on commit 00844b5

Please sign in to comment.