[FIX] web_editor: avoid flicker when browsing through items images

Since [1] when selecting item images, the 'Blocks' tab is displayed
while the options are refreshed. This is visible because the image
selection awaits an RPC which therefore allows the browser to render
the 'Blocks' tab selected version of the display.

This commit prevents the return to the 'Blocks' tab to be rendered by
waiting for the image info to be obtained on start.

Steps to reproduce:
- Drop an "Items" block.
- Click on an image.
- Click on another image.
=> The options panel flickers on the 'Blocks' tab before showing the
second image's options.

[1]: https://github.com/odoo/odoo/commit/0acc5e784b15d9c963660da3781763448503f33e

task-2821398

closes odoo/odoo#111094

X-original-commit: d5cb2810968476b82f30582cd0d6cfdbaf351b2b
Signed-off-by: Guillaume-gdi <gdi@odoo.com>
Co-authored-by: Benoit Socias <bso@odoo.com>
This commit is contained in:
Guillaume (gdi)
2023-01-27 15:11:02 +01:00
committed by Benoit Socias
co-authored by Benoit Socias
parent 3a99c36ae9
commit ba4bb36081
@@ -5431,6 +5431,11 @@ const ImageHandlerOption = SnippetOptionWidget.extend({
weightEl.classList.add('o_we_image_weight', 'o_we_tag', 'd-none');
weightEl.title = _t("Size");
this.$weight = $(weightEl);
// Perform the loading of the image info synchronously in order to
// avoid an intermediate rendering of the Blocks tab during the
// loadImageInfo RPC that obtains the file size.
// This does not update the target.
await this._applyOptions(false);
},
//--------------------------------------------------------------------------