File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
src/addons/addons/block-pins Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -266,6 +266,7 @@ export default async function({ addon }) {
266266 // 1 second is a good buffer
267267 populateCategory ( ) ;
268268 const toolbox = Blockly . mainWorkspace . getToolbox ( ) ;
269+ if ( ! toolbox ) return ;
269270 toolbox . populate_ ( toolbox . workspace_ . options . languageTree ) ;
270271 } , 1000 ) ;
271272 }
@@ -280,10 +281,12 @@ export default async function({ addon }) {
280281 if ( ! autoLoadExtPins ) vm . runtime . on ( "EXTENSION_ADDED" , ( ) => {
281282 populateInit = 2 ;
282283 } ) ;
283- vm . runtime . on ( "EXTENSION_REMOVED" , ( ) => queueMicrotask ( ( ) => {
284- updatePinCategory ( ) ;
284+ vm . runtime . on ( "EXTENSION_REMOVED" , ( extId ) => {
285+ // remove blocks in the removed extension from pins
286+ pins = pins . filter ( ( t ) => ! t . startsWith ( extId ) ) ;
287+
285288 populateInit = 2 ;
286- } ) ) ;
289+ } ) ;
287290 addon . self . addEventListener ( "disabled" , ( ) => {
288291 localStorage . removeItem ( "ADDONS_BLOCK-PINS" ) ;
289292 } ) ;
You can’t perform that action at this time.
0 commit comments