Giter Site home page Giter Site logo

Comments (4)

NicWickman avatar NicWickman commented on September 28, 2024 3

Signal boosting. This is a must.

from flume.

chrisjpatty avatar chrisjpatty commented on September 28, 2024

Ah, yeah you've discovered a constraint here with how the editor is currently designed. Right now the editor goes through a reconciliation phase if the editor is loaded with existing nodes. That reconciliation phases goes through the supplied nodes and coerces them to match the schema of the node types and input types. It could potentially become a performance hit if the editor needed to re-run the reconciliation every time the provided nodes change from the parent component. For that reason and a few others, the node editor technically always runs in an "uncontrolled" way, and internally manages its own state. But you're right that this can lead to some unexpected behavior when you try to manually provide a new set of nodes.

Would it work for you if there was an imperative function exposed on the editor that would force the reconciliation to run and reset the the nodes? Something like:

const nodeEditor = React.useRef();

const setNewNodes = () => {
  nodeEditor.setNodes({...newSetOfNodes})
}

return (
  <div>
    <button onClick={setNewNodes}>Set New Nodes</button>
    <NodeEditor ref={nodeEditor} />
  </div>
)

There may be a better way to handle this in the future to with some more advanced reconciliation of previous and current nodes, but would this work for your use case in the meantime?

from flume.

andraz-at avatar andraz-at commented on September 28, 2024

Yes, if I can get NodeEditor ref function to trigger an update manually, then I can control the updates that way.

p.s.: The connections bug was on the store side, NodeEditor now renders all connections ok, example on link updated.

from flume.

netgfx avatar netgfx commented on September 28, 2024

Is this a feature are are waiting on? or is there something we can use to dynamically add nodes?

from flume.

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.