diff options
| author | qsm-odoo <qsm@odoo.com> | 2020-04-09 06:36:16 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2020-04-14 08:29:56 +0000 |
| commit | 88e115b48032d9f0fab143bea6a5dc660e49686f (patch) | |
| tree | 9c3bdcb8c9bcfb21a129d5ebaab42a8467787c07 /addons/web/static/src/js/fields | |
| parent | 4ce1340f4f2bfb0adfbb56b59a9617a8624bd742 (diff) | |
[FIX] web_tour: add dom untracked modifications rules
This commit adds some untracked modifications rules that ignore
these DOM modifications:
- Ignore when the class "o_tooltip_parent" is added or removed (will
be important with the next commit)
- Ignore when the ID of an element changes (normally never in Odoo
codebase (at least not alongside other changes), but jQuery uses
ID modification for some performance improvements).
This is required to avoid loops in the update system (the
o_tooltip_parent class is added, thus we update tips, which search the
DOM so jQuery changes IDs, thus we update tips, which ...). Previously,
this already occured but less frequently than it is about to be
with future tips improvements.
To be able to do that change, the system had to be reviewed. Indeed,
the DOM mutation observer was debounced thus leading to considering a
very small portion of DOM mutation. As we now have to check the addition
or removal of a specific class or ID, we have to consider them all. In
fact, it worked by chance before... this occured:
1) The user clicks on something, the UI is updated -> DOM mutation
2) The code uses jQuery so a strange ID update is done -> DOM mutation
3) As the observer is debounced, we only see (2), which was not an
ignored DOM mutation -> we update the tips.
Now that (2) is an ignored DOM mutation, if we still debounce, (3) will
not update the tips while it should have because of (1). In fact, this
could theoratically break already: if (2) is a tip update for some
reason, (1) will be forgotten in the current codebase.
Instead of debouncing we now register all DOM mutations and process
them in a debounced way. So if I receive 3949 mutations over half a
second, I will save them all but only start processing them once I am
not receiving some anymore. And most of the time, only a couple of
processing is needed to know that a tracked DOM mutation occured, which
thus needs to lead to a tip update.
Part of https://github.com/odoo/odoo/pull/48678
task-2228694
Diffstat (limited to 'addons/web/static/src/js/fields')
0 files changed, 0 insertions, 0 deletions
