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

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Mar 24 08:34:50 CET 2021

On 24.03.21 08:31, Dominik Csapak wrote:
> On 3/24/21 08:21, Thomas Lamprecht wrote:
>> 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...
> but AFAIR, extjs actually parses the function *text* to find the
> data dependencies (see https://docs.sencha.com/extjs/6.0.1/classic/src/Formula.js.html)

here the rendered docs version of that source code link

> and i hope that the JIT does not change the text of the function
> at all....

Not sure if there are any guarantees on that and not touching the src.
But yeah I slowly remember, and my issue then probably came from an use of
a variable as get parameter, which then naturally cannot work.

More information about the pmg-devel mailing list