diff options
Diffstat (limited to 'addons/web_editor/static/src/js')
| -rw-r--r-- | addons/web_editor/static/src/js/editor/snippets.editor.js | 15 |
1 files changed, 11 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 cf194d45082..3997e6df15c 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -2216,22 +2216,29 @@ var SnippetsMenu = Widget.extend({ async _execWithLoadingEffect(action, contentLoading = true, delay = 500) { const mutexExecResult = this._mutex.exec(action); if (!this.loadingTimers[contentLoading]) { - this.loadingTimers[contentLoading] = setTimeout(() => { + const addLoader = () => { this.loadingElements[contentLoading] = this._createLoadingElement(); if (contentLoading) { this.$snippetEditorArea.append(this.loadingElements[contentLoading]); } else { this.el.appendChild(this.loadingElements[contentLoading]); } - }, delay); + }; + if (delay) { + this.loadingTimers[contentLoading] = setTimeout(addLoader, delay); + } else { + addLoader(); + } this._mutex.getUnlockedDef().then(() => { // Note: we remove the loading element at the end of the // execution queue *even if subsequent actions are content // related or not*. This is a limitation of the loading feature, // the goal is still to limit the number of elements in that // queue anyway. - clearTimeout(this.loadingTimers[contentLoading]); - this.loadingTimers[contentLoading] = undefined; + if (delay) { + clearTimeout(this.loadingTimers[contentLoading]); + this.loadingTimers[contentLoading] = undefined; + } if (this.loadingElements[contentLoading]) { this.loadingElements[contentLoading].remove(); |
