From cf0d5487d6cb5e49da5f1215cf2ffe4a0ef0c29d Mon Sep 17 00:00:00 2001
From: Paul Kaplan <pkaplan@media.mit.edu>
Date: Fri, 25 Jan 2019 12:53:47 -0500
Subject: [PATCH] Avoid double toolbox update when setting the locale

---
 src/containers/blocks.jsx | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/containers/blocks.jsx b/src/containers/blocks.jsx
index f64e7c307..a3bf58722 100644
--- a/src/containers/blocks.jsx
+++ b/src/containers/blocks.jsx
@@ -170,13 +170,16 @@ class Blocks extends React.Component {
     }
 
     setLocale () {
-        this.workspace.getFlyout().setRecyclingEnabled(false);
         this.ScratchBlocks.ScratchMsgs.setLocale(this.props.locale);
         this.props.vm.setLocale(this.props.locale, this.props.messages)
             .then(() => {
+                this.workspace.getFlyout().setRecyclingEnabled(false);
                 this.props.vm.refreshWorkspace();
-                this.updateToolbox();
-                this.workspace.getFlyout().setRecyclingEnabled(true);
+                // refreshWorkspace will cause a toolbox update
+                // wait for update to go through before reenabling recycling
+                this.withToolboxUpdates(() => {
+                    this.workspace.getFlyout().setRecyclingEnabled(true);
+                });
             });
     }
 
-- 
GitLab