From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id A3359BA47B for ; Tue, 19 Mar 2024 18:07:34 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 817ED4982 for ; Tue, 19 Mar 2024 18:07:34 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 19 Mar 2024 18:07:33 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 3FC3F48AEE for ; Tue, 19 Mar 2024 18:07:33 +0100 (CET) Message-ID: <74e01e98-d781-4f1c-8023-3b7cbbe74dbe@proxmox.com> Date: Tue, 19 Mar 2024 18:07:31 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta To: Proxmox VE development discussion , Dominik Csapak References: <20240319085138.508007-1-d.csapak@proxmox.com> Content-Language: en-GB From: Thomas Lamprecht In-Reply-To: <20240319085138.508007-1-d.csapak@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.054 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] applied: [PATCH widget-toolkit v2] utils: API2Request: defer masking after layout X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2024 17:07:34 -0000 On 19/03/2024 09:51, Dominik Csapak wrote: > since recently (not sure when exactly), the 'load()' method of the edit > window did not correctly mask the window anymore > > the reason seems to be that the API2Request tries to mask the component > before it's rendered, and that did never work correctly. > > Instead of simply calling `setLoading`, test if the component is > rendered, and if not, mask it after it has finished it's layout. > > Since we cannot guarantee that there is only one API2Request with the > waitMsgTarget set to it, nor that the 'afterlayout' and api call > responses come in a specific order, we count the loads, and only > ever unmask the component when the counter reaches zero again. > > Since we're strictly in non-async code here and javascript is > single-threaded, this should not result in a data race. > > Signed-off-by: Dominik Csapak > --- > changes from v1: > * use a counter for all loads instead of a unique id to keep the loading > mask until all loads are finished that were started in the meantime > * improve commit message to make the data race sentence correct > > src/Utils.js | 21 +++++++++++++++++---- > 1 file changed, 17 insertions(+), 4 deletions(-) > > applied, thanks!