Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scratch Custom Block Mapping Causes Name and Input Type Conflicts #999

Open
Titanium2099 opened this issue Feb 21, 2025 · 0 comments
Open

Comments

@Titanium2099
Copy link

Titanium2099 commented Feb 21, 2025

When you create a new block named CUSTOM_BLOCK (INPUT 1) and then define another block called CUSTOM_BLOCK (INPUT 2), the first block definition becomes obsolete. Regardless of which instance of the block you use, the second one is always executed.

This happens because, internally, Scratch maps custom blocks to a generic identifier: CUSTOM_BLOCK %s (for block 1) and CUSTOM_BLOCK %s (for block 2), where %s represents an input (and %b represents a boolean). Since both blocks share the same mapping, Scratch cannot distinguish between them, leading it to always execute the most recently defined version.

There are two possible solutions:

  1. Modify scratch-blocks to correctly recognize and obey the internal custom block ID. (Each block currently does have a unique internal ID, it just not being used (you can actually successfully parse a custom block into the editor without specifying its id at all)).
  2. (Probably easier) Prevent users from creating custom blocks that would result in duplicate mappings with an existing block.
@Titanium2099 Titanium2099 changed the title Due to the way that scratch maps custom blocks/procedures blocks with same name and input types override each other Scratch Custom Block Mapping Causes Name and Input Type Conflicts Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant