During react renders the blocks' xml ends up injecting twice.
````
const { loaded, project, updateProject } = useProject(); //here is stored the workspace (into data.blocks property)
const blocklyRef = useRef(null);
const { xml, workspace } = useBlocklyWorkspace({
ref: blocklyRef,
toolboxConfiguration: toolbox,
initialXml: '',
workspaceConfiguration: { zoom: { controls: true, wheel: true, startScale: 1, maxScale: 3, minScale: 0.3, scaleSpeed: 1.2 }, theme },
onWorkspaceChange: (workspace) => {
if (loaded) {
console.log(xml);
}
}
});
useEffect(() => {
if (loaded) {
Blockly.serialization.workspaces.load(JSON.parse(project.data.blocks), Blockly.getMainWorkspace());
}
}, [loaded]);
return (
<div id="blockly" ref={blocklyRef}></div>
);
````
As you can see from the following image, the xml ends up doubling each block
