Avoid double toolbox update when setting the locale

This commit is contained in:
Paul Kaplan committed 2019-01-28 09:15:19 -05:00
1 parent ef59643c94
commit cf0d5487d6
1 file changed
+6 -3
+6 -3
View File
@@ -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);
});
});
}