[pmg-devel] applied: [PATCH] panel/acme-domains: fix cyclic dependency in view model

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Mar 24 08:21:44 CET 2021

On 23.03.21 19:22, Dietmar Maurer wrote:
>> So, if on evaluation a get(X) is missed due to it being not always called,
>> like with boolean statements where a single truthy is enough for an or expression
>> like above, that data dependency is lost and one may see bug like behaviour.
>> Use intermediate variables to combat that, for example, above `accountValueHidden`
>> formula should read:
>> accountValueHidden: (get) => {
>>     let editable = get('accountEditable'), available = get('accountsAvailable');
>>     return !editable || !available;
>> },
> I guess a good JIT can still optimize that away?

You're right, that may be the case.
Albeit, I guess that for such short method where the JS engine cannot know if it is
a "hot" function (lots calls) so the JIT won't be used initially, and the interpreter
probably isn't smart enough to detect this optimization.

At least above approach helped a bit ago when I ran in such a bug, but yeah, it may
not be really future proof...

More information about the pmg-devel mailing list