Commit 96189cc3 by Boris Kocherov

[erp5_only_office] speedup updating cache by grouping

1 parent 7573a676
......@@ -5506,6 +5506,8 @@ parserFormula.prototype.setFormula = function(formula) {
if (typeof value === "function") {
this.value = new cError(cErrorType.getting_data);
this.queue = true;
formula.ws.workbook.dependencyFormulas
.addToCleanCellCache(formula.ws.getId(), opt_bbox.r1, opt_bbox.c1);
this.lazy_value = function () {
formula.lazy_value = null;
formula.queue = value()
......@@ -5513,10 +5515,6 @@ parserFormula.prototype.setFormula = function(formula) {
formula.value = ret;
formula.value.numFormat = numFormat;
formula._endCalculate();
// updateOnScreen cell
formula.ws.workbook.handlers.trigger("cleanCellCache",
formula.ws.getId(), {0: opt_bbox},
AscCommonExcel.c_oAscCanChangeColWidth.none);
formula.queue = false;
// formula.lazy_value = null;
return formula.value;
......
......@@ -967,10 +967,7 @@
tasks.push(lazy_value());
}
}
function end () {
//copy cleanCellCache to prevent recursion in trigger("cleanCellCache")
var tmpCellCache = dependency_graph.cleanCellCache;
dependency_graph.cleanCellCache = {};
function end (tmpCellCache) {
for (var i in tmpCellCache) {
dependency_graph.wb.handlers.trigger("cleanCellCache", i, {0: tmpCellCache[i]},
AscCommonExcel.c_oAscCanChangeColWidth.none);
......@@ -981,11 +978,18 @@
if (tasks.length > 0) {
new RSVP.Queue()
.push(function () {
end(dependency_graph.cleanCellCache);
})
.push(function () {
return RSVP.all(tasks);
})
.push(end);
.push(function () {
end(dependency_graph.cleanCellCache);
dependency_graph.cleanCellCache = {};
});
} else {
end();
end(dependency_graph.cleanCellCache);
dependency_graph.cleanCellCache = {};
}
},
initOpen: function() {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!