Removing unused blocks may cause collateral damage

I have been working on improvement suggestions for the TuneScope library (I’m not in the TuneScope team, just an enthusiastic user). In the process I imported several other libraries in order to use one of their function blocks. I’m happy with the result now, so I’ve been cleaning up. Wanting to remove the many unused library blocks, I selected “Unused blocks” from the file menu.

After the unused blocks were displayed, I unselected any blocks from the TuneScope library. It struck me I had to do this from the top down - I could NOT unselect the bottom item first.I later discovered that this was true for the bottom 7 out of 149 unused blocks. When I was done, the selected blocks were deleted. But in the process, the top item of my own Tunescope+ category (“SECTION’) had been deleted as well, even though it had actually been , and still was, in my script area! According to the block editor, it should be in the Tunescope+ palette, but it wasn’t. It wasn’t found by MY [blocks] either. I tried changing the category, switching the “in palette” option on/off, changing the label … nothing helped - and I could still use, and duplicate, the block within the script area.

Fortunately, I had had the good sense, and foresight, to shortly before save my project under two different names. A day earlier I had lost a much larger part of my project in a similar way - and then it had turned out that, unfortunately, only the situation from three days before could be restored.

I have now repeated the process as described above several times on multiple platforms (iPad, Windows PC). It happens every time, so I assume it will be reproducible for the Snap! team. I found out it happens when I unselect only the very first unused block, too - or any other unselections I tried. When I don’t unselect any block, the Unused Block Removal Process appears to work flawlessly, though.

This is a frozen version of the project.