[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
This commit is contained in:
Samuel Degueldre
2024-02-12 22:26:16 +00:00
parent ac572d1e76
commit bc2a3bc55c
@@ -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,
};
}