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:
Ali 2026-07-15 15:33:18 +00:00
parent 26e72c253e
commit f45414e5ac
1 changed files with 5 additions and 6 deletions

View File

@ -290,21 +290,20 @@ function vc_recompute(frm) {
// 3s after the fill settles it runs the recompute ONCE, so roll-ups / passthrough // 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. // (e.g. 301.1 = Σ children, turnover ← appendices) fill in from the report data.
// User edits (outside fill mode) are debounced. --- // 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) { function vc_mark_fill(frm) {
if (frm) vc_frm = frm; if (frm) vc_frm = frm;
vc_fill_mode = true; vc_fill_mode = true;
if (vc_fill_timer) clearTimeout(vc_fill_timer); if (vc_fill_timer) clearTimeout(vc_fill_timer);
vc_fill_timer = setTimeout(function () { vc_fill_timer = setTimeout(function () {
vc_fill_mode = false; vc_fill_mode = false;
if (vc_frm) vc_recompute(vc_frm); // one recompute after the report-fill settles if (vc_frm) vc_recompute(vc_frm); // one recompute after the report-fill burst settles
}, 3000); }, 400);
} }
function vc_onchange(frm) { function vc_onchange(frm) {
vc_frm = frm; vc_frm = frm;
if (vc_fill_mode) { vc_mark_fill(frm); return; } // during fill: extend window, no per-write recompute if (vc_fill_mode) { vc_mark_fill(frm); return; } // during report-fill: don't recompute per write (would freeze)
if (vc_calc_timer) clearTimeout(vc_calc_timer); vc_recompute(frm); // user edit: recompute instantly
vc_calc_timer = setTimeout(function () { vc_recompute(frm); }, 300); // debounce user edits
} }
// period change (dövr picker writes ay/il) starts the fill window // period change (dövr picker writes ay/il) starts the fill window