In the code below, an item is added to a collaborative list within a compound operation. In a VALUES_ADDED event handler on the list, another compound operation is started. When I run the code, I get the following error message: Exception: Uncaught Error: gapi.drive.realtime.Error: {type: invalid_compound_operation, message: "Already committed this local change.", isFatal: true}
It seems like this would not be an uncommon occurrence and arose naturally in my application, although in a more complicated way, so I can't just move the map assignment into the original compound operation. I also couldn't find any reference to such a restriction in the realtime api guide or reference documentation. Is there any way to begin a new compound operation in a call stack above a compound operation ending?
var va = function(event) {
doc.getModel().beginCompoundOperation('b');
doc.getModel().getRoot().get('map').set('key', 'value');
doc.getModel().endCompoundOperation();
};
doc.getModel().getRoot().get('list').addEventListener(gapi.drive.realtime.EventType.VALUES_ADDED, va);
doc.getModel().beginCompoundOperation('a');
doc.getModel().getRoot().get('list').push(100);
doc.getModel().endCompoundOperation();