From ed2b117f5b462980ef9f3e4cd41bda5fdd6ee15f Mon Sep 17 00:00:00 2001 From: Gorash Date: Fri, 8 Jul 2022 10:14:06 +0000 Subject: [PATCH] [IMP] web: Added log information to help fix errors from services. A typo fix is added. Fix error from loading xml while widget is destroyed. Now that the xml templates are loaded in the bundle, the error appears more frequently. Part-of: odoo/odoo#95500 --- .../static/src/services/public_livechat_service.js | 4 +++- addons/web/static/lib/qweb/qweb2.js | 2 +- addons/web/static/src/env.js | 2 +- addons/web_editor/static/src/js/editor/snippets.options.js | 2 +- addons/website_slides/static/src/js/slides_course_quiz.js | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/im_livechat/static/src/services/public_livechat_service.js b/addons/im_livechat/static/src/services/public_livechat_service.js index 181d0aa08cc..1b1c06ba240 100644 --- a/addons/im_livechat/static/src/services/public_livechat_service.js +++ b/addons/im_livechat/static/src/services/public_livechat_service.js @@ -11,7 +11,9 @@ export const publicLivechatService = { return { mountLivechatButton() { const livechatButton = new LivechatButton(rootWidget, messaging); - livechatButton.appendTo(document.body); + livechatButton.appendTo(document.body).catch(error => { + console.info("Can't load 'LivechatButton' because:", error); + }); return livechatButton; }, }; diff --git a/addons/web/static/lib/qweb/qweb2.js b/addons/web/static/lib/qweb/qweb2.js index 7c66e48fefd..9757ee39ad2 100644 --- a/addons/web/static/lib/qweb/qweb2.js +++ b/addons/web/static/lib/qweb/qweb2.js @@ -267,7 +267,7 @@ QWeb2.Engine = (function() { if (name && extend) { // Clone template and extend it if (!this.templates[extend]) { - return this.tools.exception("Can't clone undefined template " + extend); + return this.tools.exception("Can't clone undefined template '" + extend + "' to create '" + name + "'"); } this.templates[name] = this.templates[extend].cloneNode(true); this.extend_templates[name] = (this.extend_templates[extend] || []).slice(); diff --git a/addons/web/static/src/env.js b/addons/web/static/src/env.js index e96bc44aea9..3ee7d10811f 100644 --- a/addons/web/static/src/env.js +++ b/addons/web/static/src/env.js @@ -125,7 +125,7 @@ async function _startServices(env, toStart) { }) .catch((error) => { services[name] = error; - console.error(error); + console.error("Can't load service '" + name + "' because:", error); }) .finally(resolve); }) 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 cff72fd145d..37b7dafb895 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -3865,7 +3865,7 @@ const SnippetOptionWidget = Widget.extend({ // widget start. parentEl.removeChild(el); - if (widget.isContainer()) { + if (widget.isContainer() && !widget.isDestroyed()) { return this._renderXMLWidgets(widget.el, widget); } }); diff --git a/addons/website_slides/static/src/js/slides_course_quiz.js b/addons/website_slides/static/src/js/slides_course_quiz.js index 5cd7514143a..087c26ef12a 100644 --- a/addons/website_slides/static/src/js/slides_course_quiz.js +++ b/addons/website_slides/static/src/js/slides_course_quiz.js @@ -831,4 +831,4 @@ export var Quiz = Quiz; export var ConfirmationDialog = ConfirmationDialog; - export const websiteSlidesQuizNoFullscree = publicWidget.registry.websiteSlidesQuizNoFullscreen; + export const websiteSlidesQuizNoFullscreen = publicWidget.registry.websiteSlidesQuizNoFullscreen;