Comments (9)
This is a consistent pain point from an original design decision that makes updating the nodes dynamically difficult for performance. I'm going to get this fixed so it wi work like you'd expect a controlled react component to work. I'm in the process of converting the whole library to typescript and then this feature is up next.
from flume.
I just realized this was closed, but might actually be my problem. Did you ever find a work-around for this?
from flume.
I found a work around here. You can assign the key prop of the NodeEditor
component and tap into which ever event is modifying the nodes and change the key
as well.
for eg: if this.props.nodes
is what's changing.
componentDidUpdate(prevProps) {
if (this.props.nodes !== prevProps.nodes) {
this.ukey = (new Date()).toISOString(); //not a good idea to use date, but works for testing
}
}
and render like
render() {
return (
<NodeEditor
ref={this.nodeEditor}
portTypes={this.flconfig.portTypes}
nodeTypes={this.flconfig.nodeTypes}
nodes={this.props.nodes}
context={this.props.context}
onChange={this.handleChange}
key={this.ukey}
/>
);
}
from flume.
@idling-mind That was helpful in keeping the nodes, but the connections don't seem to re-render for some reason.
As you can see, it seems from the console.logged node that the connection is still there, but they're just not rendering after goes away, or is replaced (say I switch to one of the tabs on the top or switch out one key'd node editor for another by selecting it on the right.
(Initial State - the connections are drawn)
(Final State - I swapped views and came back, the nodes are there, the connection data is in tact from above, but the connections are now missing and no longer work).
Not sure where they're going, and I'm still a bit of a react noob, so maybe I'm overlooking some newbie mistake with react or redux, but of course, if the connection system breaks then I didn't do a good job of saving the state and the app is broken from then on. I would try digging into the source, but I'm not sure how to do that with an NPM JS project verses a traditional JS script.
from flume.
I'm also not sure why the connection should disappear. May be try different versions of the libraries?
from flume.
I'm running into this problem in 0.8.0
, which does not appear to still support the key
property. Any suggestions on how to manually set the nodes in the editor?
from flume.
Is there any update on this? I'm building a web app that uses this, and unfortunately I'm a react noob
from flume.
Maybe creating a new imperative method to load the new nodes should work?
If we can't update the state directly for performance reasons, having a chance to update via a method can be good enough for most of the cases.
i`ve made a PR to propose a solution, hope you like it. (link)
from flume.
Any way to break into it would be awesome.
from flume.
Related Issues (20)
- Selectable nodes by drag and drop?
- 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
- Support mobile? (ipad)
- Well done! HOT 1
- Inquiry on Project Maintenance Status for Flume HOT 3
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.