diff --git a/src/containers/blocks.jsx b/src/containers/blocks.jsx index 3aeffa851a36cc701dd3aeac3bbe2a38a6bbfbd7..c95576f73150c0e3294c80d97bc6d04a9b1b8638 100644 --- a/src/containers/blocks.jsx +++ b/src/containers/blocks.jsx @@ -223,19 +223,15 @@ class Blocks extends React.Component { // Remove and reattach the workspace listener (but allow flyout events) this.workspace.removeChangeListener(this.props.vm.blockListener); const dom = this.ScratchBlocks.Xml.textToDom(data.xml); - // @todo This line rerenders toolbox, and the change in the toolbox XML also rerenders the toolbox. - // We should only rerender the toolbox once. See https://github.com/LLK/scratch-gui/issues/901 this.ScratchBlocks.Xml.clearWorkspaceAndLoadFromXml(dom, this.workspace); this.workspace.addChangeListener(this.props.vm.blockListener); if (this.props.vm.editingTarget && this.state.workspaceMetrics[this.props.vm.editingTarget.id]) { - setTimeout(() => { - const {scrollX, scrollY, scale} = this.state.workspaceMetrics[this.props.vm.editingTarget.id]; - this.workspace.scrollX = scrollX; - this.workspace.scrollY = scrollY; - this.workspace.scale = scale; - this.workspace.resize(); - }, 0); + const {scrollX, scrollY, scale} = this.state.workspaceMetrics[this.props.vm.editingTarget.id]; + this.workspace.scrollX = scrollX; + this.workspace.scrollY = scrollY; + this.workspace.scale = scale; + this.workspace.resize(); } } handleExtensionAdded (blocksInfo) {