Git Product home page Git Product logo

Comments (13)

ferdaarikan avatar ferdaarikan commented on May 2, 2024 2

Hi, Thanks for looking into this. I have created a small example. When app is running clicking save, clear, load buttons reproduces the issue.

from react-diagrams.

dylanvorster avatar dylanvorster commented on May 2, 2024 2

Thanks for taking the time to do this, Ill jump onto this shortly and see what I can do.

from react-diagrams.

dylanvorster avatar dylanvorster commented on May 2, 2024 1

Fixed in 2.5.2

from react-diagrams.

dylanvorster avatar dylanvorster commented on May 2, 2024

does this still happen in the 2.4.8?

from react-diagrams.

gen4sp avatar gen4sp commented on May 2, 2024

Yes, it throws an error now "Cannot find Node Port element with nodeID:..."
It looks like just fired before the model was serialized.
I am making a request to a server and trying to serialize the model.

how code looks like

componentDidMount() {

    API.httpGet('/stage')
      .then((stageJson) => {
        let model2 = new SRD.DiagramModel();
        this.state.engine.setDiagramModel(model2);
        model2.deSerializeDiagram(stageJson, this.state.engine);
        subscribeModel(model2); //subscribe to model events
        this.setState({model:model2});
        _.each(model2.getNodes(),subscribeNode.bind(this)); //subscribe to node events
        this.forceUpdate()
      });
  }

from react-diagrams.

brunoalano avatar brunoalano commented on May 2, 2024

I had the same error. I created a new LinkWidget and LinkFactory. I'm searching where can be the problem.

from react-diagrams.

brunoalano avatar brunoalano commented on May 2, 2024

I a workaround that I made is reimporting 2 times, with a timeout of 100 milliseconds.

  serializationImport() {
    try {
      // Parse the JSON
      let object = JSON.parse(this.state.serializationInput);

      // Create a new Model
      let newModel = new SRD.DiagramModel();
      newModel.deSerializeDiagram(object, this.engine);

      // Render the `newModel`
      this.model = newModel;
      this.engine.setDiagramModel(newModel);
      this.forceUpdate();

      this._tempTimeout = setTimeout(() => {
        this.serializationImport();
        clearTimeout(this._tempTimeout);
      }, 100);

    } finally {
      this.toggleSerializationModal();
    }
  }

from react-diagrams.

ferdaarikan avatar ferdaarikan commented on May 2, 2024

I have a similar issue. I am using default factories. When I deserialize the diagram with a new engine and empty model links don't get created with an error like

Cannot find Node Port element with nodeID: [1e0a6c3f-592b-49ab-a953-0b8eb67e1a55] and name: [sensorValue]

If I deserialize the model twice links appear. Probably something to do with deserialization order. Nodes need to be created before the links are created. I can see this in the logs as well, first links are added and then removed due to the node not found error message.

from react-diagrams.

dylanvorster avatar dylanvorster commented on May 2, 2024

arghhh race conditions :C If you can provide me with a test case ill try fix it

from react-diagrams.

sanfilippopablo avatar sanfilippopablo commented on May 2, 2024

Any update on this?

from react-diagrams.

sanfilippopablo avatar sanfilippopablo commented on May 2, 2024

Hold on, I think I got it. I'll send a PR in a few minutes.

from react-diagrams.

sanfilippopablo avatar sanfilippopablo commented on May 2, 2024

I think this is fixed in PR #80 , can anyone confirm?

from react-diagrams.

dylanvorster avatar dylanvorster commented on May 2, 2024

Fixed in caadbf4

from react-diagrams.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.