diff options
| author | qsm-odoo <qsm@odoo.com> | 2019-12-16 15:24:19 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2019-12-19 15:15:50 +0000 |
| commit | 32e294e7dae298edb4d421d78a309f583b2c4fed (patch) | |
| tree | 4ef87c5fd115aabf276ee56aefe9b516ab4e4c90 | |
| parent | d7813c49c27fe7dd6a28be6631a1f41679b10d51 (diff) | |
[REF] web_editor: regroup snippets menu mutexes
Snippet enabling operations and snippet edition operations were mutexed
individually. In fact it simplifies the code and it is probably better
to chain all snippet operations, through an unique mutex.
Part of https://github.com/odoo/odoo/pull/41789
| -rw-r--r-- | addons/web_editor/static/src/js/editor/snippets.editor.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index 3e2790cdeb0..34701a34034 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -786,10 +786,9 @@ var SnippetsMenu = Widget.extend({ this.options.snippets = 'web_editor.snippets'; } this.snippetEditors = []; - this._activateSnippetMutex = new concurrency.Mutex(); this._enabledEditorHierarchy = []; - this._snippetEditionMutex = new concurrency.Mutex(); + this._mutex = new concurrency.Mutex(); this.setSelectorEditableArea(options.$el, options.selectorEditableArea); @@ -1195,7 +1194,7 @@ var SnippetsMenu = Widget.extend({ if (this._blockPreviewOverlays && previewMode) { return Promise.resolve(); } - return this._activateSnippetMutex.exec(() => { + return this._mutex.exec(() => { return new Promise(resolve => { // Take the first parent of the provided DOM (or itself) which // should have an associated snippet editor and create + enable it. @@ -1952,7 +1951,7 @@ var SnippetsMenu = Widget.extend({ * @param {function} ev.data.exec */ _onSnippetEditionRequest: function (ev) { - this._snippetEditionMutex.exec(ev.data.exec); + this._mutex.exec(ev.data.exec); }, /** * @private |
