perf(vat): make user-edit recompute instant; trim the post-fill wait
Drop the 300ms debounce on manual edits (the formula_editor storm it guarded against is already handled by fill mode), so dependent cells update immediately. Shorten the post-report-fill settle from 3s to 400ms — the one delay that must stay, since recomputing during the hundreds-of-cells fill would freeze the form. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
26e72c253e
commit
f45414e5ac
|
|
@ -290,21 +290,20 @@ function vc_recompute(frm) {
|
|||
// 3s after the fill settles it runs the recompute ONCE, so roll-ups / passthrough
|
||||
// (e.g. 301.1 = Σ children, turnover ← appendices) fill in from the report data.
|
||||
// User edits (outside fill mode) are debounced. ---
|
||||
var vc_fill_mode = false, vc_fill_timer = null, vc_calc_timer = null, vc_frm = null;
|
||||
var vc_fill_mode = false, vc_fill_timer = null, vc_frm = null;
|
||||
function vc_mark_fill(frm) {
|
||||
if (frm) vc_frm = frm;
|
||||
vc_fill_mode = true;
|
||||
if (vc_fill_timer) clearTimeout(vc_fill_timer);
|
||||
vc_fill_timer = setTimeout(function () {
|
||||
vc_fill_mode = false;
|
||||
if (vc_frm) vc_recompute(vc_frm); // one recompute after the report-fill settles
|
||||
}, 3000);
|
||||
if (vc_frm) vc_recompute(vc_frm); // one recompute after the report-fill burst settles
|
||||
}, 400);
|
||||
}
|
||||
function vc_onchange(frm) {
|
||||
vc_frm = frm;
|
||||
if (vc_fill_mode) { vc_mark_fill(frm); return; } // during fill: extend window, no per-write recompute
|
||||
if (vc_calc_timer) clearTimeout(vc_calc_timer);
|
||||
vc_calc_timer = setTimeout(function () { vc_recompute(frm); }, 300); // debounce user edits
|
||||
if (vc_fill_mode) { vc_mark_fill(frm); return; } // during report-fill: don't recompute per write (would freeze)
|
||||
vc_recompute(frm); // user edit: recompute instantly
|
||||
}
|
||||
|
||||
// period change (dövr picker writes ay/il) starts the fill window
|
||||
|
|
|
|||
Loading…
Reference in New Issue