The reason for this error is that I have read some of the past topics, and I got a circular reference in the data, but I need a little bit of help from the goJS team.
1.The data structure is:
nodeDataArray
[{key:1},{key:2},{key:3}…]
linkDataArray
[{from:1,to:2},{from:2,to:3}]
Is this a circular reference? Here from:1 is the init type. But is it actually the object whose key is 1? A bit confused
2. There is a problem with this stack overflow, which aspect to check for for goJS. (Of course, in javascript, there is usually an infinite loop)
3. If it is really the first question, then how to solve it? Because this data I need to keep
Thanks Reply
The problem arises because I show a batch of data about 5000 nodes 5000 side data. Then there are many such "from:a to:b from:b to :c " data structures, using:
var obj = {
class:“graphLinkModel”,
nodeDataArray:myNodeArray,
linkDataArray:myLinkArray,
First answer your question:
Browser is chrome 68.+version layout is “ForceDirectedLayout”
other browsers Edge error is Out of stack space Same
I have gone through many tests , So I think the problem is in the data, but it is difficult to determine what the problem is from the data display, because it conforms to the JSON format and some of the formatting issues described in the documentation.
If you are convenient, I can send the data mail to you. The problem of stack overflow is 100% recurring.
This error is almost always means you have a problem with recursion in JavaScript code, as there isn’t any other way in JavaScript to consume lots of stack. Sometimes calling a recursive function over and over again, causes the browser to send you Maximum call stack size exceeded error message as the memory that can be allocated for your use is not unlimited.
Be considerate while calling functions , also dry run is the best practice to prevent them. It’s possible to cause infinite recursion in a fully promisified code, too. That can happen if the promises in a chain don’t actually perform any asynchronous execution , in which case control never really returns to the event loop, even though the code otherwise appears to be asynchronous. That’s when it’s useful to wrap your recursive function call into a -
setTimeout
setImmediate or
process.nextTick
In some programming languages this can be solved with tail call optimization, where the recursion call is transformed under the hood into a loop so no maximum stack size reached error exists.