Skip to content
Snippets Groups Projects
Commit 606dbc79 authored by xO-Tx's avatar xO-Tx
Browse files

[FIX] web_editor: fix Theme tab infinite loading


ISSUE:

The click on "THEME" tab in editor panel triggers the
'_onThemeTabClick' method which:

1- Starts the loader ('_execWithLoadingEffect' method).
2- Runs '_activateSnippet' which uses the same mutex as the
loader.

Execution order:

A1- '_execWithLoadingEffect' with promise: adds the loader in
the DOM immediately.
A2- '_activateSnippet' sets a second loader to be added after
a delay = 500.
A3- 'releaseLoader' removes the first loader.
A4- '_activateSnippet' ends : (before adding the second
loader: t(4) - t(2) < 500) and timeout is cleared.

In some cases we get t(4) - t(2) > 500 which adds a second
loader to the DOM, and the new flow will be:

B1- Same as A1.
B2- Same as A2.
B3- Second loader added to the DOM / replaces the first one
in 'loadingElements'.
B4- 'releaseLoader' removes the second loader (from the DOM
& 'this.loadingElements').
B5- Same as A4 but the first loader still in the DOM.

The goal of this commit is to fix this behaviour by preventing
more than one loader on the target element.

task-2656308

closes odoo/odoo#77226

Signed-off-by: default avatarQuentin Smetz (qsm) <qsm@odoo.com>
parent 73ca102e
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment