Skip to content
Snippets Groups Projects
Commit ebbf292f authored by Paul Kaplan's avatar Paul Kaplan
Browse files

Fix toolbox updating after see-inside.

We can't rely on refreshWorkspace always causing a toolbox update, so make sure to update the toolbox manually if it is needed.
parent 52a6136c
No related branches found
No related tags found
No related merge requests found
......@@ -142,11 +142,7 @@ class Blocks extends React.Component {
// different from the previously rendered toolbox xml.
// Do not check against prevProps.toolboxXML because that may not have been rendered.
if (this.props.isVisible && this.props.toolboxXML !== this._renderedToolboxXML) {
// rather than update the toolbox "sync" -- update it in the next frame
clearTimeout(this.toolboxUpdateTimeout);
this.toolboxUpdateTimeout = setTimeout(() => {
this.updateToolbox();
}, 0);
this.requestToolboxUpdate();
}
if (this.props.isVisible === prevProps.isVisible) {
......@@ -178,15 +174,19 @@ class Blocks extends React.Component {
this.workspace.dispose();
clearTimeout(this.toolboxUpdateTimeout);
}
requestToolboxUpdate () {
clearTimeout(this.toolboxUpdateTimeout);
this.toolboxUpdateTimeout = setTimeout(() => {
this.updateToolbox();
}, 0);
}
setLocale () {
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();
// refreshWorkspace will cause a toolbox update
// wait for update to go through before reenabling recycling
this.requestToolboxUpdate();
this.withToolboxUpdates(() => {
this.workspace.getFlyout().setRecyclingEnabled(true);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment