[FIX] website: disconnect the observer before destroy the TOC snippet
A DOM observer is initialized at the start of the table of content (TOC) snippet options but is never disconnected. This could lead to memory leak. The goal of this commit is to disconnect this observer and stop intercepting the changes of the DOM at the destroy of the snippet option. Related PR: https://github.com/odoo/odoo/pull/110860 closes odoo/odoo#113075 X-original-commit: 3787599479d2f1e951bca6622c7049b62d631795 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -20,6 +20,14 @@ options.registry.TableOfContent = options.Class.extend({
|
||||
this.observer.observe(targetNode, config);
|
||||
return this._super(...arguments);
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
destroy: function () {
|
||||
// The observer needs to be disconnected first.
|
||||
this.observer.disconnect();
|
||||
this._super(...arguments);
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user