You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched for similar issues before opening a new one.
Component
The block-dynamic-connection plugin
Description
The existence of the overrideOldBlockDefinitions method in the block-dynamic-connections plugin API suggests that the block definitions in this plugin can be used as drop-in replacements for the blocks they replace, but
the blocks provided by the plugin are not compatible with the block generator functions for the blocks they replace, and
the plugin does not provide (and therefore overrideOldBlockDefinitions cannot install) block generator functions for the dynamic blocks.
Add one, two or three text blocks to the inputs of the join block.
Click on the JavaScript tab of the playground output panel.
Observe that the code generated for the join block is always [].join('');, regardless of attached text blocks.
Additional Info
The specific incompatibility in dynamic_text_join vs text_join is that the former has a count property named itemCount while in the latter it is named itemCount_.
It is probably that similar incompatibilities exist for the other dynamic blocks.
It is probably possible to rewrite the dynamic blocks to be generator-compatible with the blocks they replace, but this is likely to be fragile:
Any changes to either the original blocks or their dynamic replacements could break compatibility.
Using types defined in Blockly's blocks/*.ts modules in the dynamic blocks could help (it could help prevent breakages when modifying the plugin, and later help us to notice breakages caused by modifications to the library blocks / generators when upgrading the blockly package in the blockly-samples repo) but most of the relevant types are not currently exported from the top-level blockly/blocks entrypoint.
It would therefore probably be better to provide separate block generator functions for the dynamic blocks.
I think that ideally these should conform to the same interfaces as the blocks in core, since we advertise them as drop-in replacements. (We ran into similar problems with them not serializing the same way that the blocks in core do). Having them conform to the same interface would allow folks writing generators for new languages to not have to worry about supporting this plugin as well.
Check for duplicates
Component
The
block-dynamic-connection
pluginDescription
The existence of the
overrideOldBlockDefinitions
method in theblock-dynamic-connections
plugin API suggests that the block definitions in this plugin can be used as drop-in replacements for the blocks they replace, butoverrideOldBlockDefinitions
cannot install) block generator functions for the dynamic blocks.Reproduction steps
dynamic_text_join block
to the workspace.text
blocks to the inputs of the join block.[].join('');
, regardless of attached text blocks.Additional Info
dynamic_text_join
vstext_join
is that the former has a count property nameditemCount
while in the latter it is nameditemCount_
.blocks/*.ts
modules in the dynamic blocks could help (it could help prevent breakages when modifying the plugin, and later help us to notice breakages caused by modifications to the library blocks / generators when upgrading theblockly
package in the blockly-samples repo) but most of the relevant types are not currently exported from the top-levelblockly/blocks
entrypoint.Thanks to forum user Martynas Brazauskas for reporting this issue.
The text was updated successfully, but these errors were encountered: