From 36623d16874f7175e5b9dda0506765b11d151de3 Mon Sep 17 00:00:00 2001 From: Benoit Socias Date: Mon, 17 Jul 2023 14:54:05 +0000 Subject: [PATCH] [FIX] website: fix website text edition test Since [1] the `website_text_edition` tour fails because it manages to change tab, drop a block, select a paragraph and click on a button before the bundle reload happens. This commit makes sure `updateOptionsUI` is awaited and that any subsequent call is only queued afterwards. task-3370939 [1]: https://github.com/odoo/odoo/commit/c511e100cad2febc0ebb9ce61b5eb52232e60f7d closes odoo/odoo#129855 X-original-commit: 81abdb96aeb95e492230d39000e28c0d239840de Signed-off-by: Quentin Smetz (qsm) Signed-off-by: Benoit Socias (bso) --- .../static/src/js/editor/snippets.editor.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/addons/website/static/src/js/editor/snippets.editor.js b/addons/website/static/src/js/editor/snippets.editor.js index 82476244b8f..df31a49b73a 100644 --- a/addons/website/static/src/js/editor/snippets.editor.js +++ b/addons/website/static/src/js/editor/snippets.editor.js @@ -462,18 +462,20 @@ const wSnippetMenu = weSnippetEditor.SnippetsMenu.extend({ * @private */ _onReloadBundles(ev) { - this._mutex.exec(() => { - const excludeSelector = this.optionsTabStructure.map(element => element[0]).join(', '); - for (const editor of this.snippetEditors) { - if (!editor.$target[0].matches(excludeSelector)) { - if (this._currentTab === this.tabs.THEME) { + const excludeSelector = this.optionsTabStructure.map(element => element[0]).join(', '); + for (const editor of this.snippetEditors) { + if (!editor.$target[0].matches(excludeSelector)) { + if (this._currentTab === this.tabs.THEME) { + this._mutex.exec(() => { editor.destroy(); - } else { - editor.updateOptionsUI(true); - } + }); + } else { + this._mutex.exec(async () => { + await editor.updateOptionsUI(true); + }); } } - }); + } }, });