Since [this commit], some throttle calls have been replaced by debounced
calls. This commit modifies those calls in three cases.
The first case is to adapt the overlay covering when the window is
resized or content changes. Note: to reproduce the problem, you might
have to use a test tour for example, as the last operation has to be
done really quickly.
Steps to reproduce the problem:
- Go on a product page.
- Double click on the product image and replace it by one of your own.
- Quickly click on the "Remove" button to remove the product image.
-> Problem: In the `ReplaceMedia` option, the call to `destroy()` (due
to the change of target) is done after the call to `removeMedia()`.
A race condition appears here as since [this commit], the function
`updateCurrentSnippetEditorOverlay()` (responsible of the destroy of the
options whose `$target` are not in the DOM anymore) is debounced and not
throttled anymore. This is a problem for two reasons:
- We do not want the first call to the function to be deferred.
- We want this function to be executed at least at a certain rate if
there are a lot of `content_changed` events recorded in a short period
of time.
This commit also removes the call to a debounced version of a function
at a `mouseup` event in the context of the `ColorpickerWidget`. Indeed,
while the use of a debounced or a throttled version of a function is
totally justified at a `scroll` or a `mousemove` event, it is not in the
case of a `mouseup` event as the occurrence of this kind of event can
not be very high over a give time period.
Finally, this commit restores the use of a throttled version of the post
animation cover.
This can be justified by the fact that we want the post animation cover
function to be executed at least at a certain rate if there are a lot
transition or animation end events recorded in a short period of time.
[this commit]: https://github.com/odoo/odoo/commit/f4f0f783183507df8227b37fe1234c256325df6d
task-3111601
X-original-commit: 4c9eb9589e81b02945618195fbe12a4dd0ab9a50
Part-of: odoo/odoo#133546