Skip to content

Commit

Permalink
Fixed find blocks method if fieldname is similiar to 'blocks' (#6299)
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliaghisini authored Sep 24, 2024
1 parent 6429d49 commit 2c55abb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/volto/news/6299.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed findBlocks when no blocks are passed. @giuliaghisini
2 changes: 1 addition & 1 deletion packages/volto/src/helpers/Blocks/Blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ export function isBlockContainer(block) {
* @param {Object} types A list with the list of types to be matched
* @return {Array} An array of block ids
*/
export function findBlocks(blocks, types, result = []) {
export function findBlocks(blocks = {}, types, result = []) {
Object.keys(blocks).forEach((blockId) => {
const block = blocks[blockId];
// check blocks from data as well since some add-ons use that
Expand Down

0 comments on commit 2c55abb

Please sign in to comment.