From 5feda35e6fa3bb6a88e35b4f05fa4ea7e9c960b0 Mon Sep 17 00:00:00 2001 From: abd-msyukyu-odoo Date: Thu, 3 Aug 2023 15:15:21 +0000 Subject: [PATCH] [IMP] web_editor: put rollback code assignation on its own line If the `_toRollback` property of the editor is assigned on its own line, it is easier to identify which assignation caused/prevented a rollback when debugging. closes odoo/odoo#130894 X-original-commit: 263dcbaf9aa0c48bd61bf85b091c746d7850cfe1 Signed-off-by: David Monjoie (dmo) --- .../src/js/editor/odoo-editor/src/OdooEditor.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js index 115cba01261..f688230294f 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js @@ -964,9 +964,9 @@ export class OdooEditor extends EventTarget { } case 'childList': { record.addedNodes.forEach(added => { - this._toRollback = - this._toRollback || - (containsUnremovable(added) && UNREMOVABLE_ROLLBACK_CODE); + if (!this._toRollback && containsUnremovable(added)) { + this._toRollback = UNREMOVABLE_ROLLBACK_CODE; + } const mutation = { 'type': 'add', }; @@ -1486,8 +1486,9 @@ export class OdooEditor extends EventTarget { } } unbreakableStepUnactive() { - this._toRollback = - this._toRollback === UNBREAKABLE_ROLLBACK_CODE ? false : this._toRollback; + if (this._toRollback === UNBREAKABLE_ROLLBACK_CODE) { + this._toRollback = false; + } this._checkStepUnbreakable = false; } historyPauseSteps() {