We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a5b43a1 + a1fb5bb commit 399cae5Copy full SHA for 399cae5
src/useBlocklyWorkspace.ts
@@ -11,6 +11,7 @@ function importFromXml(
11
onImportXmlError?: (error: any) => void
12
) {
13
try {
14
+ if (workspace.getAllBlocks(false).length > 0) return; // we won't load blocks again if they are already loaded
15
Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(xml), workspace);
16
return true;
17
} catch (e) {
@@ -62,7 +63,7 @@ const useBlocklyWorkspace = ({
62
63
}, [onDispose]);
64
65
const handleWorkspaceChanged = React.useCallback(
- (newWorkspace) => {
66
+ (newWorkspace: WorkspaceSvg) => {
67
if (onWorkspaceChange) {
68
onWorkspaceChange(newWorkspace);
69
}
0 commit comments