Skip to content

Commit

Permalink
Change parent context logic
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed May 24, 2024
1 parent f3229f3 commit b1b768c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2516,9 +2516,16 @@ export function getBlockContext( state, clientId ) {
// TODO: Review if it's necessary to get the context from the parent blocks.
getBlockParents( state, clientId ).forEach( ( parent ) => {
const block = getBlock( state, parent );
const blockType = getBlockType( state, block.name );
const blockType = getBlockType( block.name );
if ( blockType?.providesContext ) {
blockContext = { ...blockContext, ...blockType?.providesContext };
Object.keys( blockType.providesContext ).forEach(
( attributeName ) => {
blockContext = {
...blockContext,
[ attributeName ]: block.attributes[ attributeName ],
};
}
);
}
} );
return blockContext;
Expand Down

0 comments on commit b1b768c

Please sign in to comment.