public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* Re: [pmg-devel] applied: [PATCH] panel/acme-domains: fix cyclic dependency in view model
@ 2021-03-23 18:22 Dietmar Maurer
  2021-03-24  7:21 ` Thomas Lamprecht
  0 siblings, 1 reply; 6+ messages in thread
From: Dietmar Maurer @ 2021-03-23 18:22 UTC (permalink / raw)
  To: Thomas Lamprecht, Wolfgang Bumiller; +Cc: pmg-devel

> 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?




^ permalink raw reply	[flat|nested] 6+ messages in thread
* [pmg-devel] applied: [PATCH] panel/acme-domains: fix cyclic dependency in view model
@ 2021-03-23 16:29 Thomas Lamprecht
  2021-03-23 17:27 ` Thomas Lamprecht
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Lamprecht @ 2021-03-23 16:29 UTC (permalink / raw)
  To: pmg-devel; +Cc: Wolfgang Bumiller

A view model forumla cannot depend on itself, as that is a dependency
cycle.

In this specific case we can just drop the `hasUsage` forumla entry
completely, it is bogus as it was just returning its value, and that
is actually taken care of by the `hasUsage` data binding.

The debug build of ExtJS throws an exception on such cycles, the
release build does not cares to much and seems to do the right thing
already here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---

@Wolfgang, or was there an actual reason this formula got added in the first
place?

 src/panel/ACMEDomains.js | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/panel/ACMEDomains.js b/src/panel/ACMEDomains.js
index f66975f..2b6c204 100644
--- a/src/panel/ACMEDomains.js
+++ b/src/panel/ACMEDomains.js
@@ -47,7 +47,6 @@ Ext.define('Proxmox.panel.ACMEDomains', {
 	    editBtnIcon: (get) => 'fa black fa-' + (get('accountEditable') ? 'check' : 'pencil'),
 	    accountTextHidden: (get) => get('accountEditable') || !get('accountsAvailable'),
 	    accountValueHidden: (get) => !get('accountEditable') || !get('accountsAvailable'),
-	    hasUsage: (get) => get('hasUsage'),
 	},
     },
 
-- 
2.20.1





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-24  7:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23 18:22 [pmg-devel] applied: [PATCH] panel/acme-domains: fix cyclic dependency in view model Dietmar Maurer
2021-03-24  7:21 ` Thomas Lamprecht
2021-03-24  7:31   ` Dominik Csapak
2021-03-24  7:34     ` Thomas Lamprecht
  -- strict thread matches above, loose matches on Subject: below --
2021-03-23 16:29 Thomas Lamprecht
2021-03-23 17:27 ` Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal