I often include a little demo of a custom block within the block editor, below the block definition. Thus I can always test if any changes I make to the definition code work out well. Ans if anyone else would like to use the custom block (e.g. as part of a library), the demo is part of the documentation, showing how to use it.
However something strange happens when I make a duplicate of the original block (right-click at the block; select "duplicate block definition"): the demo code with the original block's definition is now calling the duplicate block.
This is not helpful, of course.
Is it a known issue?
Is it going to be fixed?
Is there a workaround I could use in the meantime?
No, his detached example code isn't part of the original block definition, so isn't involved in its recursion.
I would understand this if it were the other way around, if the sample code in the duplicate block called the original block. But this seems like a definite bug to me.
Well of course you can manually edit the original block. If you mean, can you fix it programmatically, I don't know if there's even a way to get pointers to detached scripts in a Block Editor.
Oh, I see what's happening, and why this is a bug.
Whenever you have a block definition with floating blocks of itself (not attached to any scripts), then when you duplicate a block, those floating blocks with be replaced with the duplicate block.