From ba4bb36081c0c879029990747fde7efae56dc2c5 Mon Sep 17 00:00:00 2001 From: "Guillaume (gdi)" Date: Mon, 23 Jan 2023 08:56:41 +0000 Subject: [PATCH] [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 Co-authored-by: Benoit Socias --- addons/web_editor/static/src/js/editor/snippets.options.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index e7468e21050..9da8466cdf7 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -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); }, //--------------------------------------------------------------------------