Commit 96189cc3 authored by Boris Kocherov's avatar Boris Kocherov

[erp5_only_office] speedup updating cache by grouping

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