Skip to content

Moving a mutated block throws errors #4022

@aabounegm

Description

@aabounegm

Describe the bug

I have a simple block with a checkbox field, and a mutator to add a value input if the checkbox is checked (and remove it when unchecked). When I add the block to the workspace and check the box, it adds the input successfully, but upon dragging that block to move it everything breaks and the workspace just keeps throwing errors.

To Reproduce

I created a JSFiddle with minimum code to reproduce the bug: https://jsfiddle.net/dzs18j6e/

Expected behavior

The block should be moved without causing errors

Screenshots

image

Desktop (please complete the following information):

  • OS: Windows 10 (2004 update)
  • Browser: Chrome
  • Version: 83.0.4103.116

Stack Traces

Logs from the screenshot above, exported from Chrome's console (using "Save as..." from context menu)
blockly_compressed.js?e98f:304 Uncaught TypeError: Cannot read property 'fieldRow' of undefined
    at Blockly.InsertionMarkerManager.createMarkerBlock_ (blockly_compressed.js?e98f:304)
    at new Blockly.InsertionMarkerManager (blockly_compressed.js?e98f:299)
    at new Blockly.BlockDragger (blockly_compressed.js?e98f:318)
    at Blockly.TouchGesture.Blockly.Gesture.startDraggingBlock_ (blockly_compressed.js?e98f:443)
    at Blockly.TouchGesture.Blockly.Gesture.updateIsDraggingBlock_ (blockly_compressed.js?e98f:440)
    at Blockly.TouchGesture.Blockly.Gesture.updateIsDragging_ (blockly_compressed.js?e98f:442)
    at Blockly.TouchGesture.Blockly.Gesture.updateFromEvent_ (blockly_compressed.js?e98f:437)
    at Blockly.TouchGesture.Blockly.Gesture.handleMove (blockly_compressed.js?e98f:448)
    at Blockly.TouchGesture.handleMove (blockly_compressed.js?e98f:658)
    at HTMLDocument.h (blockly_compressed.js?e98f:795)
Blockly.InsertionMarkerManager.createMarkerBlock_ @ blockly_compressed.js?e98f:304
Blockly.InsertionMarkerManager @ blockly_compressed.js?e98f:299
Blockly.BlockDragger @ blockly_compressed.js?e98f:318
Blockly.Gesture.startDraggingBlock_ @ blockly_compressed.js?e98f:443
Blockly.Gesture.updateIsDraggingBlock_ @ blockly_compressed.js?e98f:440
Blockly.Gesture.updateIsDragging_ @ blockly_compressed.js?e98f:442
Blockly.Gesture.updateFromEvent_ @ blockly_compressed.js?e98f:437
Blockly.Gesture.handleMove @ blockly_compressed.js?e98f:448
Blockly.TouchGesture.handleMove @ blockly_compressed.js?e98f:658
h @ blockly_compressed.js?e98f:795
blockly_compressed.js?e98f:448 Uncaught TypeError: Cannot read property 'dragBlock' of null
    at Blockly.TouchGesture.Blockly.Gesture.handleMove (blockly_compressed.js?e98f:448)
    at Blockly.TouchGesture.handleMove (blockly_compressed.js?e98f:658)
    at HTMLDocument.h (blockly_compressed.js?e98f:795)
Blockly.Gesture.handleMove @ blockly_compressed.js?e98f:448
Blockly.TouchGesture.handleMove @ blockly_compressed.js?e98f:658
h @ blockly_compressed.js?e98f:795
blockly_compressed.js?e98f:448 Uncaught TypeError: Cannot read property 'dragBlock' of null
    at Blockly.TouchGesture.Blockly.Gesture.handleMove (blockly_compressed.js?e98f:448)
    at Blockly.TouchGesture.handleMove (blockly_compressed.js?e98f:658)
    at HTMLDocument.h (blockly_compressed.js?e98f:795)
Blockly.Gesture.handleMove @ blockly_compressed.js?e98f:448
Blockly.TouchGesture.handleMove @ blockly_compressed.js?e98f:658
h @ blockly_compressed.js?e98f:795
blockly_compressed.js?e98f:448 Uncaught TypeError: Cannot read property 'dragBlock' of null
    at Blockly.TouchGesture.Blockly.Gesture.handleMove (blockly_compressed.js?e98f:448)
    at Blockly.TouchGesture.handleMove (blockly_compressed.js?e98f:658)
    at HTMLDocument.h (blockly_compressed.js?e98f:795)
Blockly.Gesture.handleMove @ blockly_compressed.js?e98f:448
Blockly.TouchGesture.handleMove @ blockly_compressed.js?e98f:658
h @ blockly_compressed.js?e98f:795
blockly_compressed.js?e98f:448 Uncaught TypeError: Cannot read property 'dragBlock' of null
    at Blockly.TouchGesture.Blockly.Gesture.handleMove (blockly_compressed.js?e98f:448)
    at Blockly.TouchGesture.handleMove (blockly_compressed.js?e98f:658)
    at HTMLDocument.h (blockly_compressed.js?e98f:795)
Blockly.Gesture.handleMove @ blockly_compressed.js?e98f:448
Blockly.TouchGesture.handleMove @ blockly_compressed.js?e98f:658
h @ blockly_compressed.js?e98f:795
blockly_compressed.js?e98f:448 Uncaught TypeError: Cannot read property 'dragBlock' of null
    at Blockly.TouchGesture.Blockly.Gesture.handleMove (blockly_compressed.js?e98f:448)
    at Blockly.TouchGesture.handleMove (blockly_compressed.js?e98f:658)
    at HTMLDocument.h (blockly_compressed.js?e98f:795)
Blockly.Gesture.handleMove @ blockly_compressed.js?e98f:448
Blockly.TouchGesture.handleMove @ blockly_compressed.js?e98f:658
h @ blockly_compressed.js?e98f:795
blockly_compressed.js?e98f:448 Uncaught TypeError: Cannot read property 'dragBlock' of null
    at Blockly.TouchGesture.Blockly.Gesture.handleMove (blockly_compressed.js?e98f:448)
    at Blockly.TouchGesture.handleMove (blockly_compressed.js?e98f:658)
    at HTMLDocument.h (blockly_compressed.js?e98f:795)
Blockly.Gesture.handleMove @ blockly_compressed.js?e98f:448
Blockly.TouchGesture.handleMove @ blockly_compressed.js?e98f:658
h @ blockly_compressed.js?e98f:795
blockly_compressed.js?e98f:449 Uncaught TypeError: Cannot read property 'endBlockDrag' of null
    at Blockly.TouchGesture.Blockly.Gesture.handleUp (blockly_compressed.js?e98f:449)
    at Blockly.TouchGesture.handleUp (blockly_compressed.js?e98f:659)
    at HTMLDocument.h (blockly_compressed.js?e98f:795)
Blockly.Gesture.handleUp @ blockly_compressed.js?e98f:449
Blockly.TouchGesture.handleUp @ blockly_compressed.js?e98f:659
h @ blockly_compressed.js?e98f:795
blockly_compressed.js?e98f:448 Uncaught TypeError: Cannot read property 'dragBlock' of null
    at Blockly.TouchGesture.Blockly.Gesture.handleMove (blockly_compressed.js?e98f:448)
    at Blockly.TouchGesture.handleMove (blockly_compressed.js?e98f:658)
    at HTMLDocument.h (blockly_compressed.js?e98f:795)
Blockly.Gesture.handleMove @ blockly_compressed.js?e98f:448
Blockly.TouchGesture.handleMove @ blockly_compressed.js?e98f:658
h @ blockly_compressed.js?e98f:795
blockly_compressed.js?e98f:448 Uncaught TypeError: Cannot read property 'dragBlock' of null
    at Blockly.TouchGesture.Blockly.Gesture.handleMove (blockly_compressed.js?e98f:448)
    at Blockly.TouchGesture.handleMove (blockly_compressed.js?e98f:658)
    at HTMLDocument.h (blockly_compressed.js?e98f:795)
Blockly.Gesture.handleMove @ blockly_compressed.js?e98f:448
Blockly.TouchGesture.handleMove @ blockly_compressed.js?e98f:658
h @ blockly_compressed.js?e98f:795
blockly_compressed.js?e98f:448 Uncaught TypeError: Cannot read property 'dragBlock' of null
    at Blockly.TouchGesture.Blockly.Gesture.handleMove (blockly_compressed.js?e98f:448)
    at Blockly.TouchGesture.handleMove (blockly_compressed.js?e98f:658)
    at HTMLDocument.h (blockly_compressed.js?e98f:795)
Blockly.Gesture.handleMove @ blockly_compressed.js?e98f:448
Blockly.TouchGesture.handleMove @ blockly_compressed.js?e98f:658
h @ blockly_compressed.js?e98f:795

Additional context

I noticed that if the block in question was connected to another block, and that parent block gets dragged, the operation goes smoothly without any errors. It also works fine if the checkbox gets unchecked before attempting to move the block.

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: 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