Skip to content

Call to setFieldValue triggered on Create causes rendering issues #3773

@moniika

Description

@moniika

Describe the bug

Calling setFieldValue and changing the field text to a different length on create event trigger causes rendering issue with insertion marker and with connection alignment.

To Reproduce

Steps to reproduce the behavior:

  1. Add the following code into the Blockly playground:
function reproCode() {
  workspace.addChangeListener(
      function(event) {
        if (event.type == Blockly.Events.CREATE) {
          var block = workspace.getBlockById(event.blockId);
          if (block.type == 'colour_random') {
            block.setFieldValue('hey');
          }
        }
      }
  );
}

as well as call to reproCode() after playground workspace has been instantiated.
2.
3. Load the following xml:

<xml xmlns="https://developers.google.com/blockly/xml">
  <block type="lists_create_with" id="Cwr1zGV:9Et{nyS[|`*U" x="63" y="138">
    <mutation items="3"></mutation>
  </block>
</xml>
  1. Drag a colour_random block directly over into create list connection
  2. Observe how insertion marker size is incorrect
  3. Connect block and observe how connection is misaligned.

Expected behavior

Block insertion marker should reflect new size of block after field value was changed and connection should be aligned correctly.

Screenshots
2a08f77b-e0a9-4c84-8e71-005c38b18d61

Additional context

Caused the issue with plane demo in bug #3639
Also tried to repro with triggering of UI event, where label changes size and did not see issue with connection alignment, but did also see issue with insertion marker size.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions