Skip to content

Offer "full serialization" and "minimal serialization" for events #1266

@ex0ns

Description

@ex0ns

While trying to save the undostack to make it persistent, I noticed that move event are not serialized correctly, indeed, oldParentId and oldCoordinate are not saved into the JSON, I don't know if it's the expected behaviour, but it seems pretty strange:

It can be reproduced easily, first move a block into the workspace, then run the following code, and undo the last event, it will throw an error (Cannot read property 'nextConnection' of null).

const save = Blockly.mainWorkspace.undoStack_.map(function(event) { return event.toJson(); });
Blockly.mainWorkspace.clearUndo();

Blockly.mainWorkspace.undoStack_ = save.map(function(event) {
    return Blockly.Events.fromJson(event, Blockly.mainWorkspace);
}

If this is indeed a bug, I could submit the fix I wrote for my app.

ex0ns

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions