reaviz/reagraph

Node disappears when I move it

Closed this issue · 13 comments

Describe the bug

when I take a node and move it to some place, it stays there, however, when I click on the button and set new nodes with connections that include the same node that I moved before, it disappears. And the error "Got NaN while animating: " comes out, as I understand it, this happens because the link to the object is locked inside the react memory, but I try to forcefully delete old links and make a set of new objects, but it still disappears

Steps to Reproduce the Bug or Issue

make a [ ] of nodes, make the graph draggable, write a func which will change nodes collection and all collection need to have atleast 1 node with the same id, drag one node, and click on button to change [ ] of nodes

Expected behavior

atleast i want to re-create the nodes, i dont need that its stay on place where i move it...

Screenshots or Videos

Platform

  • Reagraph Version: [e.g. 4.8.3]
  • OS: [Windows,
  • Browser: [Chrome]
  • NodeJS version: 16.15

Your Example Website or App

No response

Additional context

hope u will help, im trying to fix this about 1 week T_T

amcdnl commented

@SmirnovArtyom516 - Can you share a reproduction repo? The demos seem to be working fine.

@SmirnovArtyom516 - Can you share a reproduction repo? The demos seem to be working fine.

i think, i cant give u link on demo couse for demo my project is too big, i will send u a screenshots, if u will need a demo i'll try to transfer on codesand box.

So, i use a react-redux to save nodes and edges state in store. And put info from store to graph

image

I send a request to api from where new edges are returned to me and I dispatch them to redux

image

On the sendbox code, I managed to cause this bug, I will now try to find it and throw it here.

Thank you in advance for your help

amcdnl commented

Code sandbox would be fine.

Code sandbox would be fine.

4.4.5 version last ver. without this bug

amcdnl commented

What build system are you using?

What build system are you using?

VITE + TS

@amcdnl
Hi, thanks for the prompt feedback, the draggable property is very important in my project, I just wanted to clarify if I should wait for a fix for this bug.
If yes, approximately what time?

amcdnl commented

@SmirnovArtyom516 - thanks for the demo - I was able to reproduce it. I will have some time on Thursday to check this out and let you know.

@amcdnl
Hello)
So, may i know ur verdict?

amcdnl commented

should be resolved by #108

@amcdnl
Thank u so much for this fast fix and fast feedback.
I really appreciate it :)

amcdnl commented

@SmirnovArtyom516 - No problem; it was a tricky one for sure :D. Don't forget to share the word about the project!