Comments (6)
Thanks for bringing this up, this is something I've thought about but haven't settled on the best way to handle it. The problem is that you technically could set up cyclical graphs that are valid, as long as the function for one of the nodes in the loop knows to break out it at some point. It would probably be trivial to just track the number of loops in the engine and bail out if it ever gets to some very high number. Maybe that would be a sensible default to have it bailout after like 5000 loops or something, but make it overridable so you can allow infinite loops if you want.
from flume.
That's what I'm thinking. The ability to do cyclical graphs would be useful in many cases, but having the JS engine choke seems a bad idea. Having Flume handle it makes a lot of sense, especially if you add the iteration configuration option.
from flume.
Yeah I think you're right. Do you have an opinion on the details of how this exception should be handled? My instinct is to not bail out of the entire resolveRootNode
function, and instead only bail out of the processing of the current root node input. I have a pending PR that detects circular dependencies per root node input, and throws a descriptive warning, but doesn't crash the engine. That way if you have 5 inputs to the root node, and only one has a circular dependency problem, the values of the remaining 4 ports will still correctly resolve, and the value of the circular port will resolve to undefined and log an error.
from flume.
I'm toying with the idea of also adding this check to the node editor itself as an opt-in validation. That way users could be warned if their node setup would create an infinite loop, or better yet, do the check when connecting a port and prevent the connection if it would result in a cyclical graph. (Also with a warning toast of some kind potentially).
from flume.
All of this sounds great. Doing the check when making the connection makes the most sense, since it will only happen at that moment instead of multiple times. Doing a recursive check through a large graph could get pretty expensive, so doing it once would keep it fast.
from flume.
Agreed, I'll merge the engine bailout part of this and then open and link a new issue for doing this check in the editor. Thanks again for bringing this up.
from flume.
Related Issues (20)
- is this project still in development? HOT 1
- [Question] Vanilla JS usage ? HOT 2
- Type 'string' is not comparable to type 'NodeType' HOT 2
- Support for "any" datatype on ports
- Saving/loading of paths HOT 1
- I can't add nodetypes dynamic
- Clone of version v0.8.2 but version compatibility problem on installation HOT 1
- Bug: Cannot read properties of null (reading 'setAttribute')
- Connecting nodes to already connected input?
- Branching logic
- Getting and setting pan and zoom HOT 1
- Theming documentation missing closing backtick
- Animated connections
- How to actually extract context?
- Rendering custom components in nodes
- Flume for NEXT.js v14 HOT 3
- Support mobile? (ipad)
- Well done! HOT 1
- Inquiry on Project Maintenance Status for Flume HOT 3
- Custom node connectors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flume.