Skip to content

Block IDs can repeat across multiple uses #9043

@BenHenning

Description

@BenHenning

Check for duplicates

  • I have searched for similar issues before opening a new one.

Description

Block IDs are not guaranteed to be re-generated when inserting a block from the flyout, and can even be duplicated in other contexts (such as with the minimap plugin--see RaspberryPiFoundation/blockly-samples#2512).

Note that this issue here is not that IDs are reused, it's that the focus system can have multiple nodes with identical IDs. This can result in unpredictable or outright incorrect behavior (see RaspberryPiFoundation/blockly-keyboard-experimentation#521 for one example of what can happen when IDs are duplicated).

The fix here isn't to change core behavior but, rather, to change what the focus system relies upon.

Reproduction steps

  1. Open the simple test playground for the latest version of v12.
  2. Add a block from the flyout.
  3. Observe that the block's ID in the workspace is the same as it was in the flyout.

Stack trace

Screenshots

No response

Browsers

No response

Metadata

Metadata

Assignees

Labels

injectionissue: bugDescribes why the code or behaviour is wrong

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions