From 05857f8d5cdda247434e64a804fcda086d9413d5 Mon Sep 17 00:00:00 2001 From: "Arthur Detroux (ard)" Date: Tue, 13 Sep 2022 12:20:23 +0000 Subject: [PATCH] [FIX] web_editor: avoid updating ui if a page reload is required This commit solves an issue detailed below, where an action would be scheduled while the page is meant to be reloaded, creating a deadlock. Commit [1] reviewed the hamburger option and introduced a hack so that if the no-hamburger option is selected while a template which requires a hamburger is also selected, the option for the default hamburger is automatically selected. This is done with a hack that clicks on a button when the ui of the option is updated. The issue is that the click creates a subsequent ui update, and since the value will only be updated once the page reloads, a second click occurs, which triggers a second save request. With [2] that save request locks the editor because the wysiwyg_adapter does not expect a second save_request, and starts a second blockUI which is never removed once the iframe is reloaded. This commit ensures that the auto-update click happens only once. Steps to reproduce: - Edit your website - Click on the navbar - Select the Mobile Menu option "Same as desktop" - Change the header template for one with a hamburger menu - Click on the navbar => the editor is locked forever. [1]: https://github.com/odoo/odoo/commit/6854ff8026999a2de20d163ff7118a59c33064c8 [2]: https://github.com/odoo/odoo/commit/03c552690b15cbf2e7d6b7812386ac64042219af X-original-commit: 15dc96bdf626940b3493e02998f9534d9f393a70 Part-of: odoo/odoo#101687 --- addons/web_editor/static/src/js/editor/snippets.options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 8c44e98fb62..8e8d1eda074 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -4112,7 +4112,7 @@ const SnippetOptionWidget = Widget.extend({ this.options.wysiwyg.odooEditor.historyStep(); } - if (previewMode) { + if (previewMode || requiresReload) { return; }