question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

State: nodes incorrectly positioned on rerender

See original GitHub issue

i calculate node positioning from my server and pass those nodes directly to a Graph component.

when my nodes initially render, they are positioned correctly, but if i later pass a new set of nodes, the positioning is wrong – the tree appears much larger and less dense, it’s as if the x/y position for each node gets multiplied by some number. if i then refresh my page, my nodes appear positioned correctly again.

i understand react-flow manages internal position state - i’m wondering if something isn’t getting cleared on rerender?

i suspect i could get around the problem if i had the ability to reset position state before passing Graph new elements.

in case you aren’t sure what’s going on, i’ll keep poking to see if i can identify the root cause.

thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kinneycommented, May 14, 2020

amazing - it’s all working great. thank you!

1reaction
krizkacommented, May 14, 2020

@moklick thank you! great lib!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Flow doesn't re-render on elements state change #1168
Now I have another problem is that when I programmatically change the position of a node, it stands still.
Read more >
Does React re-render all components when any state ...
Just wrapping my graph component's export in memo solved my immediate problem. I think I would expect, and want the components that consume ......
Read more >
Updating NodeViews on node moved - Discuss - ProseMirror
I'm building react backed NodeViews that are rerendered when the ... nodeSize; const moveNodeUp = view.state.tr .replace(pos, pos + node.
Read more >
Avoid unnecessary remounting of DOM elements in React
I ran into a strange problem while trying to use React's built-in animation API to fade in/out DOM elements when they enter/exit the...
Read more >
How to Force Re-Render a React Component & Should ...
Simply use forceUpdate method to force React to Re-Render the ... Incorrectly updating props without a state change can also leads to bugs....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found