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

Insertion markers get disconnected/reconnected before being deleted #7002

Closed
NeilFraser opened this issue Apr 21, 2023 · 2 comments · Fixed by #7005
Closed

Insertion markers get disconnected/reconnected before being deleted #7002

NeilFraser opened this issue Apr 21, 2023 · 2 comments · Fixed by #7005
Labels
component: insertion marker issue: bug Describes why the code or behaviour is wrong type: regression

Comments

@NeilFraser
Copy link
Contributor

NeilFraser commented Apr 21, 2023

Description

When a block is inserted into a stack, the stack is split, and the tail of the stack is reconnected to the bottom of the new block. Unfortunately, this also applies to insertion markers. An insertion marker gets disconnected and reconnected. The corresponding events get broadcast. And this results in errors when undoing and redoing, since there's no block with the ID of the insertion marker.

Reproduction steps

  1. On the playground, turn on event logging and open the console.
  2. Create two statement blocks.
  3. Connect one statement block to the bottom of the other statement block

Observe that in addition to the expected events, there's also two events relating to the insertion marker:

  1. The insertion marker is disconnected from the bottom of the top statement block.
  2. The insertion marker is connected to the bottom of the bottom statement block.

Stack trace

{
    "workspaceId": "Ug].Xjo0iE8en8B=Rxq3",
    "isUiEvent": false,
    "type": "move",
    "group": "2OAGxl(TQw%EHp)AFA,C",
    "recordUndo": true,
    "isBlank": false,
    "blockId": "#iC6mjz3JEkmX3L|FDqz",
    "oldParentId": "if2",
    "reason": [
        "disconnect"
    ],
    "newCoordinate": {
        "x": 112.40234375,
        "y": 74.25
    }
}

{
    "workspaceId": "Ug].Xjo0iE8en8B=Rxq3",
    "isUiEvent": false,
    "type": "move",
    "group": "2OAGxl(TQw%EHp)AFA,C",
    "recordUndo": true,
    "isBlank": false,
    "blockId": "#iC6mjz3JEkmX3L|FDqz",
    "oldCoordinate": {
        "x": 112.40234375,
        "y": 74.25
    },
    "reason": [
        "connect"
    ],
    "newParentId": "if1"
}

Screenshots

Screenshot 2023-04-21 at 15 21 34

Browsers

No response

@NeilFraser NeilFraser added issue: bug Describes why the code or behaviour is wrong issue: triage Issues awaiting triage by a Blockly team member component: insertion marker labels Apr 21, 2023
@BeksOmega
Copy link
Collaborator

I think this might be a regression? I reordered some things in insertion markers when I was making performance improvements, and I might have broken this. But I haven't checked.

@NeilFraser
Copy link
Contributor Author

Confirming, this is a regression. Verified working correctly in v8.0.5, and broken in v9.3.2 (none of the intervening versions seems to compile on my machine).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: insertion marker issue: bug Describes why the code or behaviour is wrong type: regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants