]> git.proxmox.com Git - proxmox-widget-toolkit.git/commit
utils: api request: defer masking after layout
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 19 Mar 2024 08:51:38 +0000 (09:51 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 19 Mar 2024 17:05:13 +0000 (18:05 +0100)
commitd35cb8aa7c2c8ceb84b5cfb91bdb8f713d1f3773
tree274ebeb3d8e3e6f30304f186d8a7a068980d00b9
parent461bb2e56cb512bde8e8da6499809613b941bf3b
utils: api request: defer masking after layout

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 <d.csapak@proxmox.com>
src/Utils.js