Change node color in Diagram

I use this code to change color of a node.

var nodeData = myDiagram.model.findNodeDataForKey(key);
myDiagram.model.setDataProperty(nodeData, “color”, color);

I’m using Jquery tabs and my html markup is this way:

When the current tab is ‘tabsEjecuciones-1’ there’s not problem, the node change the color, but when the current tab is ‘tabsEjecuciones-2’ the canvas inside the diagram resize it to its default (300 x 150).

In the console appears a message ‘Diagram div has a width or height of zero’ but I dont resizing anything, I’m just changing node color.

What Can I do to solve this? How can I change the color of a node without resizing the canvas element?

It's not changing the color of the node that's causing the issue, its the diagram attempting to redraw and seeing that the myDiagram div has a clientWidth and a clientHeight of zero.
This occurs when the tabs are switched in this jQuery widget.
In the near future Diagrams will keep their previous size if the div clientWidth/clientHeight goes to zero

So, What Can I do to avoid this issue?, Is there any way to tell the diagram that remember its previous size?

We’re considering this a big, and it’s been fixed internally. In the next release of GoJS this won’t be an issue, because it will remember its previous size automatically.

For now, you could avoid attempting to change the Diagram if it is behind a jQuery tab, perhaps queuing commands to execute when the Diagram does come back into view.

Or you could temporarily change the div to a different off-screen div while the tab is out of view, so that it still has a size.

In any case, the next release should be out within a week or two.