diff --git a/src/containers/blocks.jsx b/src/containers/blocks.jsx
index 13b3975fdaaf77320b215bef5faadadbcc94e70b..0652e337422b70f7d88fe2bb3adea2f85cbd1267 100644
--- a/src/containers/blocks.jsx
+++ b/src/containers/blocks.jsx
@@ -64,8 +64,8 @@ class Blocks extends React.Component {
 
         // @todo hack to resize blockly manually in case resize happened while hidden
         if (this.props.isVisible) { // Scripts tab
-            window.dispatchEvent(new Event('resize'));
             this.workspace.setVisible(true);
+            window.dispatchEvent(new Event('resize'));
             this.workspace.toolbox_.refreshSelection();
         } else {
             this.workspace.setVisible(false);