Why is my definition block ordered behind a demo block?

One way to document a custom block, is to add a demo or alternative definition script to the definition window. The normal order is for the hat block + definition to be in front of the demo script. Sometimes though the scripts are automatically reordered in a reverse way:

What’s causing this? Anything I can do about it?

What is the context in which you are seeing both custom block definitions (with prototype hats) and other scripts together?

They're talking about putting example scripts inside the edit block window.

The order the clean up blocks function places scripts in is determined by they're current position. If you place the example script above the hat block, the example script will be placed above the hat block. If you put the example script under the hat block, it will be placed under the definition.

I didn't think it was possible to put anything above the actual definition (with the prototype hat block) in the block editor!

I made a tiny demonstration project for this issue.

… and - oh darn! - the issue doesn’t appear. Here’s the original (full) project, where it does appear.

Open the edit window for the streams alt multi script pic 3 custom block, and manually rearrange it such that the main script (with the hat block) comes first. Now save the change, re-open the edit window, and find that the order has been messed up.

And now I can't even fully reproduce it with the original project anymore - it appears to be what physicians call vague symptoms.

Umm yeah. Maybe Jens will be able to figure out why you're having this problem. Above my pay grade, as they say.

It’s not a big issue. I’ll let you know if I will have figured out under what conditions it surfaces.