-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[Network] Uncaught TypeError: Cannot read property 'shape' of undefined #3543
Comments
Hi there. Your fix is fine for preventing the error. However, I'm really wondering why there is an I'll see if I can simply recreate this issue. If not, I may ask you to supply me with a demo of this happening. How do you call |
Right. In the code snippet above, Can you confirm that you are passing node id's into |
Thanks for responding that quickly.
|
In that case, there is a discrepancy between the nodes defined and the nodes displayed. There is a node id in the display list which does not exist any more in the define list. Which is a situation that should never ever occur, of course. Will need to go a bit deeper in the code for this. |
Have you set option |
Indeed, I set |
Here is my whole configuration generator, if that can help
|
OK thanks, that should help. Need to stop now, real life is calling. Will pick it up again later when I'm free again. |
Even with my fix, I get this. Here are two screenshots of what I get after spreading some nodes and calling After some tests, I found this pattern :
In the two previous screenshots, the nodes that appear out of box were created after the first graph rendering. |
Looking at the code of |
I need a way to reproduce this. I'll try something myself by duplicating the steps you posted. |
I just found what was wrong. I exported my
Since I never rebuild the options, it won't match that condition again and keeps using the
|
A sincere thank you for looking into the problem yourself. I truly appreciate all external effort to fix issues. I had zoomed into that particular statement myself, only I hadn't figured out what to do about it. I think your second option is the best approach here. Any options passed in should not be changed. I need a regression test here; do you have a suggestion? |
You're welcome, glad I helped. For the regression test, well I don't know, is there any internal call in Vis where the options mutation is actually relevant in further calls ? I cannot think of any reason that would be the case, but I don't know how it works in the inside. Some options contain nested objects. Since assign() just makes shallow copies, the problem would remain the same if something is mutated in a nested option object. I would recommand using a deep copy algorithm like https://lodash.com/docs/4.17.4#cloneDeep |
I'm going to change tack here; the root of the problem is not that In fact, I'm going to scan the whole code for similar problems, see #3548, and make unit tests for them all. The |
Are you good for the moment? Or are you waiting for this fix to arrive? This for determining the urgency for next release, which officially is in a code freeze. |
That's ok, everything works fine in my app now. Thank you |
Fixes almende#3543. None of the options passed in any of the API calls should change the options. This has been registered with issue almende#3548.
Fixes almende#3543. None of the options passed in any of the API calls should change the options. This has been registered with issue almende#3548.
Hello,
This is the first time I have to post here, so before I introduce my issue, let me thank you for your amazing work.
Here is my case : Long story short, I have a network entirely controlled through the API. For instance, if I wanna delete a node, I select it and click "Delete" somewhere on my app. This sends a request to my server, which basically responds something like "You can / You cannot". When I can, I use the remove() method from the node DataSet. Works fine.
But then, when I press on my "Fit" button, which calls the Network fit() method, I get this error :
The fit() function works however fine before removing something. And magically, sometimes I won't get that error. I tried but it's hard to figure out what are the exact conditions for getting it.
I fixed getRange() like this line 44419 of the webpacked vis.js (cf the not-undefined and not-null check) and it seems to make things work :
Hope that will help.
Note :
The text was updated successfully, but these errors were encountered: