blockly-samples icon indicating copy to clipboard operation
blockly-samples copied to clipboard

Unnecessary events when interacting with functions

Open bbrudastyy opened this issue 6 months ago • 1 comments

Check for duplicates

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

Component

block-shareable-procedures

Description

Hi, I found a strange behavior when using the library. If you add this configuration (1 screenshot), then when you try to update the procedure name, add, delete or rename a parameter, unnecessary move events occur. The most interesting thing is that it works exactly starting from two or more inserted blocks in the call parameters. No such behavior was detected on the blockly core without a connected library.

I noticed that this is caused by triggerProceduresUpdate, but I couldn't find the reasons for the occurrence of unnecessary events. In addition, if you add more callable procedures besides the first one, then the move is called even on an unused procedure. (2 screenshot)

I consider this an important problem, since with a large number of such blocks, a lot of resources are spent on unnecessary operations. I would like to know which way to look in order to solve this problem.

Reproduction steps

  1. Add event logging
  2. Create the block structure as shown in the screenshot
  3. Change the name of the procedure

Stack trace


Screenshots

Image Image

bbrudastyy avatar May 30 '25 13:05 bbrudastyy

Events are triggered on all blocks, since it is not taken into account that it is worth updating only the blocks for declaring and calling the edited procedure in triggerProceduresUpdate.

bbrudastyy avatar May 30 '25 14:05 bbrudastyy