Hi.
I've built a Vue app which contains a Blockly workspace inside a Vue component. I have a save button, which serializes the workspace and sends it off to an API for storage. Later, I reload the page and the serialized workspace is loaded into the workspace.
The reloaded workspace looks correct (the blocks are recreated, and in the right places). But when I try to drag the blocks or connect new blocks I get an error (in Chrome).
I've tried this with the last v7 blockly, and with the v8 released today (!).
The error:
blockly_compressed.js?e98f:1136 Uncaught Error: Unable to find connection in connectionDB.
at Proxy.module$exports$Blockly$ConnectionDB.ConnectionDB.removeConnection (blockly_compressed.js?e98f:1136:1)
at module$exports$Blockly$RenderedConnection.RenderedConnection.moveTo (blockly_compressed.js?e98f:1042:1)
at module$exports$Blockly$RenderedConnection.RenderedConnection.moveBy (blockly_compressed.js?e98f:1043:1)
at BlockSvg.module$exports$Blockly$BlockSvg.BlockSvg.moveConnections (blockly_compressed.js?e98f:1097:1)
at BlockDragger.module$exports$Blockly$BlockDragger.BlockDragger.updateBlockAfterMove_ (blockly_compressed.js?e98f:665:1)
at BlockDragger.module$exports$Blockly$BlockDragger.BlockDragger.endDrag (blockly_compressed.js?e98f:663:1)
at module$exports$Blockly$TouchGesture.TouchGesture.module$exports$Blockly$Gesture.Gesture.handleUp (blockly_compressed.js?e98f:689:1)
at module$exports$Blockly$TouchGesture.TouchGesture.handleUp (blockly_compressed.js?e98f:1152:1)
at HTMLDocument.h (blockly_compressed.js?e98f:78:1)
Example serialization
{
"blocks": {
"blocks": [
{
"type": "show",
"x": 337,
"y": 113,
"id": "KuTZ4m8p]`Acf;=:2cve",
"fields": {
"type": "",
"table": ""
}
}
],
"languageVersion": 0
}
}
How I'm deserializing the workspace
mounted() {
var options = this.$props.options || {};
if (!options.toolbox) {
options.toolbox = this.$refs["blocklyToolbox"];
}
this.workspace = Blockly.inject(this.$refs["blocklyDiv"], options);
Blockly.serialization.workspaces.load(this.data, this.workspace);
}