GithubHelp home page GithubHelp logo

Comments (4)

netgfx avatar netgfx commented on June 2, 2024

@chrisjpatty any ideas about this? can it be done?

from flume.

chrisjpatty avatar chrisjpatty commented on June 2, 2024

@netgfx Sorry this fell off my radar. Yes this is possible, all you need is to include the flume config as part of the react state so that updating it will trigger a re-render. Here's an example.

https://codesandbox.io/s/dynamically-add-flume-types-example-omwgk

Even though this is possible, I would caution against it unless absolutely necessary for your use-case. When you create your flume config statically you can guarantee ahead of time that graphs created with that config will fit the schema of your pre-defined types. This means it's safe to import and export nodes created with that config in the root engine and the node editor. If your types are not statically defined, you become responsible for ensuring that everywhere you consume the graphs created with your dynamic configs adhere to a schema that is compatible with your code. For example, if you start with a config which includes a "number" node, but not a "string" node, and some users create graphs with or without the string node, you now need to track which graphs are using the additional node type, and ensure that when you consume the graph that your code for consuming them accounts for the difference in the two schemas. This may be easy enough to do with one or two node types, but if your schema can be quite different between users of your node editor, this could become more difficult to manage.

So in short, yes, this is possible, and there's definitely use-cases where it's the right thing to do, but I'd recommend caution.

from flume.

netgfx avatar netgfx commented on June 2, 2024

Thank you so much for the example and the explanation. So if I save the graph in a neutral place (say database) and all users restore from there, this shouldn't cause any issues right?

from flume.

Abhishek-Kumbhani avatar Abhishek-Kumbhani commented on June 2, 2024

I think, here the issue is to add a new node from pre-defined node types in FlumeConfig but not the new node type.

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.