cytoscape / cytoscape.js-dagre

The Dagre layout for DAGs and trees for Cytoscape.js
MIT License
250 stars 83 forks source link

dagre need to be update #34

Closed YikaJ closed 6 years ago

YikaJ commented 6 years ago

There is a mistake which cause by dagre's dependency graphlib@^1.0.5,.

here is the wrong code

in graphlib@^1.0.5

Graph.prototype.sources = function() {
  return _.filter(this.nodes(), function(v) {
    return _.isEmpty(this._in[v]);  // Uncaught TypeError: Cannot read property '_in' of undefined                
  }, this);
};

And In graphlib@^2.1.5, it had already fix it.

Graph.prototype.sources = function() {
  var self = this;
  return _.filter(this.nodes(), function(v) {
    return _.isEmpty(self._in[v]);  // use self to fix the 'this' problem
  });
};

It's dagre's mistake, but I think this lib should update it to avoid the error causes.I have try to update dagre@^v0.8.2 by myself, and it works well by now, maybe your team can do more test on it.

Thanks a lot for your team to provide such a great project.

maxkfranz commented 6 years ago

Merged and released as v2.2.2 patch