From bf54de9a710a366d392e488e740b94195a14aa2e Mon Sep 17 00:00:00 2001 From: "Serge Bayet (seba)" Date: Thu, 26 Oct 2023 15:15:56 +0200 Subject: [PATCH] [FIX] web_editor: force widget with reload to no-preview This commit resolves the issue that arises when a widget contains a reload attribute but lacks a no-preview attribute. That config leads to an "Uncaught Promise" error. With this update, when a reload attribute is detected, the no-preview attribute is now automatically added, preventing the error from occurring. The problem occurs since [1]. Steps to reproduce: - Go to website - Edit - Click on the header - In the navbar options, change the Mobile Alignment option. => Works but traceback anyway. [1]: https://github.com/odoo/odoo/commit/fcb16a3b1bd373726ffb54f0fbe41fb6d1784769 task-3572334 closes odoo/odoo#139909 Signed-off-by: Quentin Smetz (qsm) --- addons/web_editor/static/src/js/editor/snippets.options.js | 3 +++ 1 file changed, 3 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 394ed1e57f2..283ebda7371 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -290,6 +290,9 @@ const UserValueWidget = Widget.extend({ this.illustrationEl = document.createElement('i'); this.illustrationEl.classList.add('fa', this.options.dataAttributes.icon); } + if (this.options.dataAttributes.reload) { + this.options.dataAttributes.noPreview = "true"; + } }, /** * @override