Skip to content

Commit

Permalink
Block Editor: Ensure synced patterns are accounted for in 'getAllowed…
Browse files Browse the repository at this point in the history
…Blocks' (#52546)
  • Loading branch information
Mamaduka authored Jul 12, 2023
1 parent b05c23b commit e448fa7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2214,15 +2214,24 @@ export const getAllowedBlocks = createSelector(
return;
}

return getBlockTypes().filter( ( blockType ) =>
const blockTypes = getBlockTypes().filter( ( blockType ) =>
canIncludeBlockTypeInInserter( state, blockType, rootClientId )
);
const hasReusableBlock =
canInsertBlockTypeUnmemoized( state, 'core/block', rootClientId ) &&
getReusableBlocks( state ).length > 0;

return [
...blockTypes,
...( hasReusableBlock ? [ 'core/block' ] : [] ),
];
},
( state, rootClientId ) => [
state.blockListSettings[ rootClientId ],
state.blocks.byClientId,
state.settings.allowedBlockTypes,
state.settings.templateLock,
getReusableBlocks( state ),
getBlockTypes(),
]
);
Expand Down

1 comment on commit e448fa7

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in e448fa7.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5530843770
📝 Reported issues:

Please sign in to comment.