You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the title mentions, when I add readOnly: true, it give me below error
Uncaught Error: Existing toolbox is null. Can't create new toolbox. at WorkspaceSvg$$module$build$src$core$workspace_svg.updateToolbox (workspace_svg.ts:1869:13) at useBlocklyWorkspace.js:43:23
Hi @sujeithnath! I'm not totally sure what's happening with readOnly, but one thing I'd recommend trying is to move the toolboxConfiguration value into a const outside your React component. This will prevent useBlocklyWorkspace from trying to update the workspace on every render cycle. Could you try that out and let me know if it solves your issue?
Hi there,
As the title mentions, when I add readOnly: true, it give me below error
Uncaught Error: Existing toolbox is null. Can't create new toolbox. at WorkspaceSvg$$module$build$src$core$workspace_svg.updateToolbox (workspace_svg.ts:1869:13) at useBlocklyWorkspace.js:43:23
const {workspace} = useBlocklyWorkspace({ ref: blocklyRef, initialXml: programXml, toolboxConfiguration: { "kind": "flyoutToolbox", "contents": [ { "kind": "block", "type": "controls_if" }, { "kind": "block", "type": "controls_whileUntil" } ] }, workspaceConfiguration: { renderer: 'crc_renderer', readOnly: true, scrollbars: true, trashcan: false, grid: { spacing: 20, length: 3, colour: '#ccc', snap: true, }, media: '/blockly/media/', }, onDispose: (ws) => logger.info('on ws dispose', ws), // @ts-ignore onInject: (ws) => logger.info('injected ws', ws?.undoStack_), onWorkspaceChange: (ws) => logger.info('on ws change', ws), onImportXmlError: (error) => logger.warn('error importing XML', error) })
The text was updated successfully, but these errors were encountered: