iVis-at-Bilkent / cytoscape.js-undo-redo

A Cytoscape.js extension to provide an undo-redo framework
MIT License
46 stars 9 forks source link

Does not work as expected when the extension is used by multiple Cytoscape.js instances #9

Closed metincansiper closed 5 years ago

metincansiper commented 6 years ago

It seems like that this extension is not working as expected when it is used by by multiple Cytoscape.js instances.

I mean if you create 2 different Cytoscape.js instances as cy1 and cy2 and initialize the extension on these instances as ur1 and ur2 as below:

var ur1 = cy1.undoRedo();
var ur2 = cy2.undoRedo();

then ur1.undo() and ur2.undo() does the same thing (undo the last action performed on cy1 or cy2), while the expected behavior is that (I think) urX.undo() should undo the last action performed on cyX

The reason must be that in the following few lines (https://github.com/iVis-at-Bilkent/cytoscape.js-undo-redo/blob/master/cytoscape-undo-redo.js#L11) cy, undoStack, redoStack and actions are defined once while registering the extension. I suppose that they must be defined per Cytoscape.js instance.

ugurdogrusoz commented 6 years ago

@metincansiper could you create a PR for fixing this?

metincansiper commented 6 years ago

I created the PR (https://github.com/iVis-at-Bilkent/cytoscape.js-undo-redo/pull/10)

hasanbalci commented 5 years ago

I think, this issue doesn't exist anymore.