-
Notifications
You must be signed in to change notification settings - Fork 1.5k
EdgesHandler._addMissingEdges Cannot read property 'forEach' of null #3562
Comments
Aaaand the first issue for release No, that's not supposed to happen. The data structure is exactly the same as previous version. But this means that there is no DataSet instance for edges defined....is it remotely possible that you do not pass any edge data in? In any case, this will need a fix. |
Oops sorry wrong button. |
I'm trying to reproduce this through the standard API without much success. Could you give me some example code that shows this problem? |
will do. |
Tracked it down. (Well how to cause it anyways.....) Here's an example using the Getting Started Code The problem appears to be related to setting an options field.
triggers the bug, but the weird thing is that it doesn't matter what the value is
also triggers the bug Whereas
Does not. |
OK, got it. Can reproduce. Thanks for your sleuthing! |
That's a nice interplay of internal 'features'. The options get handled before the data and All this can be solved with a strategically placed test on |
Yep edges.physics triggers it as well. 🍺 :-) |
Yay! One for the collection. |
Was introduced in this version; had to check. We're planning a quick release in 2 weeks time precisely for this kind of |
This is where the vis/lib/network/modules/NodesHandler.js Lines 207 to 209 in c56fa19
Let's try |
Best thing to do is to block handling of |
…etting of options Fixes almende#3562. Options `hidden` and `physics` can emit a `_dataChanged` event within `setOptions()`. If this happens when setting options during the initialization of the `Network` instance, this leads to an error thrown, because there is no DataSet instance connected yet to the instance. This bug was introduced in `v4.21.0`. Unit tests have been added for this case.
Wrt to your comment on the PR: it doesn't matter what you fill in for |
yeah sorry I deleted it as soon as I wrote it. doh! |
No worries. Here, have a beer (icon): 🍺 |
…ation (#3568) * Network: Prevent crash when dataChanged is triggered during initial setting of options Fixes #3562. Options `hidden` and `physics` can emit a `_dataChanged` event within `setOptions()`. If this happens when setting options during the initialization of the `Network` instance, this leads to an error thrown, because there is no DataSet instance connected yet to the instance. This bug was introduced in `v4.21.0`. Unit tests have been added for this case. * Edited comment
Sorry about this one, should have known better than skip a null check. |
@justinharrell not a problem, shit happens. It wasn't obvious at all that this could happen. In any case, it's shared guilt, since I could have noted it when reviewing. I'm just glad we got this so early (thanks OP), in two weeks time with the next release it'll be history. |
I'm still getting the error using a DataView instead of using an array or DataSet; the problem is not a null data but a missing forEach on DataView. I expected that DataView inherits forEach from DataSet, but the forEach method is not present on DataView. I think we need to put something like: // copy foreach functionality from DataSet
DataView.prototype.forEach = DataSet.prototype.forEach; here: https://github.com/almende/vis/blob/master/lib/DataView.js#L391 |
Oops again, thought I checked and made sure Dataview had forEach. Definitely makes sense to me that it should. |
Is it necessary a new issue @justinharrell ? This was related to a null reference, while my report is about missing method |
Hi! Any idea when the fix will be released? |
Any progress with this? |
Any progress guys? |
Guys, I tried a work around to disable physics and it worked, `
` |
My workaround is to keep using the older Vis.js version 4.20.1 |
Thanks @amarvin |
The bug still exists. @aruljane-s workaround doesn't seem to work for me. Any suggestions? This bug is almost a year old, is it possible to fix it somehow? EDIT: EDIT2: |
…ation (almende#3568) * Network: Prevent crash when dataChanged is triggered during initial setting of options Fixes almende#3562. Options `hidden` and `physics` can emit a `_dataChanged` event within `setOptions()`. If this happens when setting options during the initialization of the `Network` instance, this leads to an error thrown, because there is no DataSet instance connected yet to the instance. This bug was introduced in `v4.21.0`. Unit tests have been added for this case. * Edited comment
On upgrading from 4.20.1 to 4.21. I'm now seeing this error in the console.
This appears to be caused by #3516 and discussed in #3500
Exception is raised at this line - https://github.com/almende/vis/blob/master/lib/network/modules/EdgesHandler.js#L468
Can someone explain if these changes are meant to cause this error and does it require different data structures now?
The text was updated successfully, but these errors were encountered: