Closed vilterp closed 3 years ago
Update: after stepping my way into getDerivedStateFromProps
, I was able to get it to re-render by incrementing the stage
property on each change. So, I'm unblocked, but that is a bit hard to find, and I do wish it was managed automatically somehow… 🤷 Anyway, thanks again for the library.
Hi there, it's been a while since I worked on this project so its not entirely clear in my head. But there is a note at the bottom of the readme about design decisions and there consequences, it seems at some point I decided not to automatically do a react layout on style changes and added stage property to allow you to force it to happen if you need it. It was probably just the easiest option at the time.
No worries, I was able to get it working.
Hi there, thanks for this library!
I have a component which is trying to change the background color of a node (via the
styles.shapes.styles
attribute of thenodes
prop to theDagreReact
component) as a result of a user selecting a certain node and the component's state updating. It seems that updating attributes like this doesn't cause the graph to re-render — perhaps only changing the set of nodes and edges itself, as in the timeline example.Ideally changing attributes like background color would re-render, without re-layouting, although I realize it might be difficult to know which attributes changing requires a re-layout. Thanks again!