'How to clear pre-defined blockly custom blocks in Angular

I have some problem initializing custom blocks

I created blockly custom blocks to modal

export const ConditionBlocklyBlock: Block[] = [
{
        type: 'SUM_MAT',
        message0: '%1 %2 %3',
        colour: '#F88370',
        tooltip: 'tooltip',
        inputsInline: true,
        args0: [
            {
                type: 'input_value',
                name: 'first_value'
            },
            {
                type: 'field_dropdown',
                name: 'operator',
                options: [
                    [ '>', '>' ],
                    [ '>=', '>=' ],
                    [ '<', '<' ],
                    [ '<=', '<=' ],
                    [ '==', '==' ]
                ]
            },
            {
                type: 'input_value',
                name: 'second_value'
            }
        ],
        output: "Boolean"
    },
    {
        type: 'swapList',
        message0: '%1 %2 %3',
        colour: '#F88370',
        tooltip: 'tooltip',
        inputsInline: true,
        args0: [
            {
                type: 'input_value',
                name: 'first_value',
                check: 'Boolean'
            },
            {
                type: 'field_dropdown',
                name: 'logical_operator',
                options: [
                    [ 'AND', 'AND' ],
                    [ 'OR', 'OR' ],
                ]
            },
            {
                type: 'input_value',
                name: 'second_value',
                check: 'Boolean'
            }
        ],
        output: 'Boolean'
    }
];
const conditionBlocks: Block[] = ConditionBlocklyBlock;
Blockly.defineBlocksWithJsonArray(conditionBlocks);

When the modal is opened, the block is initialized.

The first time it is opened, it is normal, but from the second time on, the following log appears.

Block definition #77 in JSON array overwrites prior definition of "SUM".
Block definition #78 in JSON array overwrites prior definition of "SUM-MAT".
Block definition #79 in JSON array overwrites prior definition of "SUM_MV".

JsonOverwritesLog

Please give me some advice.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source