diff --git a/packages/bot-skeleton/src/scratch/hooks/workspace_svg.js b/packages/bot-skeleton/src/scratch/hooks/workspace_svg.js index 348c1b5130ae..08d879d69cd1 100644 --- a/packages/bot-skeleton/src/scratch/hooks/workspace_svg.js +++ b/packages/bot-skeleton/src/scratch/hooks/workspace_svg.js @@ -146,7 +146,7 @@ Blockly.WorkspaceSvg.prototype.cleanUp = function (x = 0, y = 0, blocks_to_clean const start = (column_index - 1) * blocks_per_column; const fat_neighbour_block = root_blocks .slice(start, start + blocks_per_column) - .reduce((a, b) => (a.getHeightWidth().width > b.getHeightWidth().width ? a : b), null); + ?.reduce((a, b) => (a.getHeightWidth().width > b.getHeightWidth().width ? a : b)); let position_x = cursor_x + fat_neighbour_block.getHeightWidth().width + Blockly.BlockSvg.MIN_BLOCK_X; if (!is_import) { @@ -166,7 +166,7 @@ Blockly.WorkspaceSvg.prototype.cleanUp = function (x = 0, y = 0, blocks_to_clean const a_metrics = a.getRelativeToSurfaceXY().y + a.getHeightWidth().height; const b_metrics = b.getRelativeToSurfaceXY().y + b.getHeightWidth().height; return a_metrics > b_metrics ? a : b; - }, null); + }); original_cursor_y = lowest_root_block.getRelativeToSurfaceXY().y +