Skip to content

Deserialization not working #1005

Open
Open
@hanajiffry99

Description

I am following the documentation and trying to deserialize the diagram. I have serialized the diagram perfectly and stored it in a json file. During the deserialization process, I retrieve the saved serialized data, parse it and try to deserialize it. Althought I didnt receive any errors its not working. I am using custom nodes, links and ports to create the diagram. This si my code and Looking forward for your support to solve this issue.

const [model, setNewModel] = React.useState(new DiagramModel());

React.useEffect(() => {
    console.log("react initialized");
    window.addEventListener('message', (e) => {
        if (e.data.command === 'serialized') {

            console.log("deserialization code");
            console.log("serialized diagram 1: ", model)
            const parsed = JSON.parse(e.data.data);

            model.deserializeModel(parsed, engine)
            vscode.postMessage({ command: "success_alert", text: 'diagram updated successfully' });
            console.log("serialized diagram 2: ", model)
        }
    });
}, [])

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions