Problem importing blockly from xml

209 views
Skip to first unread message

Aviv Melnik

unread,
Apr 30, 2021, 8:06:16 AM4/30/21
to Blockly
Hi all,
I'm trying to import blockly from XML, the import works fine and the blockly load correctly, but when I try to move a block or attach a new block the next exception is being raised:
Uncaught Error: Unable to find connection in connectionDB.
    at Proxy.Blockly.ConnectionDB.removeConnection (blockly_compressed.js?e98f:681)

This is how i export the blockly (which is then being saved in a DB):
var xml = Blockly.Xml.workspaceToDom(workspace.value);
return Blockly.Xml.domToText(xml);

This is how i import the blockly:
const dom_xml = Blockly.Xml.textToDom(xml.value);
Blockly.Xml.domToWorkspace(dom_xml, workspace.value);

I guess I'm doing something incorrectly but tried to investigate and didn't found the issue, hopefully, you can help.

Thanks!

Aviv Melnik

unread,
Apr 30, 2021, 9:12:50 AM4/30/21
to Blockly

Problem partially solved:
The issue was that I was passing a Proxy object of the workspace, instead of the workspace itself, to the domToWorkspace function.
To solve this I used Blockly.mainWorkspace instead.
Reply all
Reply to author
Forward
0 new messages