From bc2a3bc55cc0f96124d14c6a7a310c2418695d20 Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Thu, 8 Feb 2024 14:26:07 +0100 Subject: [PATCH] [FIX] web: stop views leaking their models Previously, when exporting its state so that it could be restored later, the relational model would export its config. The problem is that because this config is a reactive object, it keeps a reference to the components that may need to be notified by that reactive object. This exported config was then stored on the next controller, which would be retained by the next config, etc. This commit fixes that by exporting a raw version of the config. Part-of: odoo/odoo#153654 --- .../web/static/src/model/relational_model/relational_model.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/model/relational_model/relational_model.js b/addons/web/static/src/model/relational_model/relational_model.js index 897c36a21bb..91b3bbe440d 100644 --- a/addons/web/static/src/model/relational_model/relational_model.js +++ b/addons/web/static/src/model/relational_model/relational_model.js @@ -1,7 +1,7 @@ /* @odoo-module */ // @ts-check -import { EventBus, markRaw } from "@odoo/owl"; +import { EventBus, markRaw, toRaw } from "@odoo/owl"; import { makeContext } from "@web/core/context"; import { Domain } from "@web/core/domain"; import { WarningDialog } from "@web/core/errors/error_dialogs"; @@ -161,7 +161,7 @@ export class RelationalModel extends Model { exportState() { return { - config: this.config, + config: toRaw(this.config), specialDataCaches: this.specialDataCaches, }; }