From 601eb8f144cebc0590c8f00a2986f615f52b0dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 5 Oct 2023 10:13:07 +0200 Subject: [PATCH] [REF] web: remove use of internal variable In a previous commit, we temporarily used the `__OWL__DEVTOOLS__` global variable to access the list of all apps. This was obviously not something that we want to do, so we introduced a proper hook in Owl. This commit changes the code to use the static apps object from the App class. closes odoo/odoo#137661 Signed-off-by: Aaron Bohy (aab) --- addons/web/static/src/core/assets.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/core/assets.js b/addons/web/static/src/core/assets.js index 043ba9bc2cf..34b44e6b9e6 100644 --- a/addons/web/static/src/core/assets.js +++ b/addons/web/static/src/core/assets.js @@ -4,6 +4,7 @@ import { memoize } from "./utils/functions"; import { browser } from "./browser/browser"; import { registry } from "./registry"; import { session } from "@web/session"; +import { Component, xml, onWillStart, App } from "@odoo/owl"; /** * This export is done only in order to modify the behavior of the exported @@ -236,15 +237,12 @@ registry.category("xml_templates").addEventListener("UPDATE", (ev) => { for (const element of doc.querySelectorAll("templates > [t-name]")) { templates.documentElement.appendChild(element); } - // eslint-disable-next-line no-undef - const apps = __OWL_DEVTOOLS__.apps; - for (const app of apps) { + for (const app of App.apps) { app.addTemplates(templates, app); } } }); -import { Component, xml, onWillStart } from "@odoo/owl"; /** * Utility component that loads an asset bundle before instanciating a component */