Scratch3-Dev-Tools icon indicating copy to clipboard operation
Scratch3-Dev-Tools copied to clipboard

A procedure with no labels breaks the floating input box

Open SheepTester opened this issue 4 years ago • 0 comments

image

An error is thrown when trying to sort the block names alphabetically:

chrome-extension://phacniajokfchdcamjhonkbhlcipplno/inject3.js:1631 TypeError: Cannot read property 'localeCompare' of undefined
    at chrome-extension://phacniajokfchdcamjhonkbhlcipplno/inject3.js:1999
    at Array.sort (<anonymous>)
    at buildFloatingFilterList (chrome-extension://phacniajokfchdcamjhonkbhlcipplno/inject3.js:1999)
    at middleClickWorkspace (chrome-extension://phacniajokfchdcamjhonkbhlcipplno/inject3.js:1870)
    at middleClick (chrome-extension://phacniajokfchdcamjhonkbhlcipplno/inject3.js:1887)
    at HTMLDocument.eventMouseDown (chrome-extension://phacniajokfchdcamjhonkbhlcipplno/inject3.js:1629)

https://github.com/griffpatch/Scratch3-Dev-Tools/blob/4b792e7dcac4154e6f7e4b99c5888a5fe11e9e8c/inject3.js#L2002

This is because the custom block's desc property in options is undefined, so it can't call localeCompare on it. I think it's because in getBlockText, desc is uninitialized, and since there are no text fields on the custom block, desc never gets set to a string and remains undefined.

https://github.com/griffpatch/Scratch3-Dev-Tools/blob/4b792e7dcac4154e6f7e4b99c5888a5fe11e9e8c/inject3.js#L2029

Custom extensions that define blocks that are purely inputs also will break the floating input box, which is how this issue was initially encountered

SheepTester avatar Jan 11 '21 20:01 SheepTester