From a6de8d172eb4ffed1da730f2a03ed16c86634793 Mon Sep 17 00:00:00 2001 From: Martijn van de Rijdt Date: Mon, 29 Jan 2024 14:44:20 -0500 Subject: [PATCH] fixed: temporary workaround for calculations not updating when they are non-relevant upon load, #730 --- public/js/src/module/calculate.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/public/js/src/module/calculate.js b/public/js/src/module/calculate.js index 2b8de62b5..6c918a792 100644 --- a/public/js/src/module/calculate.js +++ b/public/js/src/module/calculate.js @@ -14,6 +14,15 @@ calculationModule._updateCalc = function (control, props, emptyNonRelevant) { !control.matches('[readonly]') ); + if (emptyNonRelevant) { + // We're temporarily disabling this cache because it is causing this bug + // https://github.com/OpenClinica/enketo-express-oc/issues/730 + // which we don't quite understand yet, but need to fix urgently. + // A proper fix would have to be created in enketo/enketo after which we should remove this clause + // (and improve performance). + this.preInitRelevance = new WeakMap(); + } + return this._originalUpdateCalc(control, props, emptyNonRelevant); };