This PR improves the efficiency of code that performs toolbox updates, generally in response to changing blocks/themes/locales/variables/procedures. There are two major changes:
In componentDidMount, a block of code that updated the toolbox was removed. This block was redundant, because in the if statement on line 261, the same/technically more liberal visibility check is made, and the code then either calls setLocale (which updates the toolbox) or directly calls requestToolboxUpdate, so the removed code was performing an unnecessary duplicative toolbox update.
In situations where a call to this.props.vm.refreshWorkspace() was directly followed by a call to this.requestToolboxUpdate(), the requestToolboxUpdate() call has been removed. In the VM, refreshWorkspace()calls emitWorkspaceUpdate(), which blocks.jsx listens for and runs onWorkspaceUpdate() in response to, which in turn calls this.props.updateToolboxState(), which in turn calls updateToolbox(). As a result, these callsites were all needlessly updating the toolbox twice as well.
This PR improves the efficiency of code that performs toolbox updates, generally in response to changing blocks/themes/locales/variables/procedures. There are two major changes:
componentDidMount
, a block of code that updated the toolbox was removed. This block was redundant, because in the if statement on line 261, the same/technically more liberal visibility check is made, and the code then either callssetLocale
(which updates the toolbox) or directly callsrequestToolboxUpdate
, so the removed code was performing an unnecessary duplicative toolbox update.this.props.vm.refreshWorkspace()
was directly followed by a call tothis.requestToolboxUpdate()
, therequestToolboxUpdate()
call has been removed. In the VM,refreshWorkspace()
callsemitWorkspaceUpdate()
, which blocks.jsx listens for and runsonWorkspaceUpdate()
in response to, which in turn callsthis.props.updateToolboxState()
, which in turn callsupdateToolbox()
. As a result, these callsites were all needlessly updating the toolbox twice as well.