Merge PR #3086 into 16.0

Signed-off-by pedrobaeza
pull/3096/head
OCA-git-bot 2025-02-10 08:26:33 +00:00
commit afb1a42451
1 changed files with 14 additions and 13 deletions

View File

@ -12,14 +12,6 @@ export function useRefreshAnimation(timeout) {
const refreshClass = "o_content__refresh";
let timeoutId = null;
/**
* @returns {DOMTokenList|null}
*/
function contentClassList() {
const content = document.querySelector(".o_content");
return content ? content.classList : null;
}
function clearAnimationTimeout() {
if (timeoutId) {
clearTimeout(timeoutId);
@ -29,11 +21,20 @@ export function useRefreshAnimation(timeout) {
function animate() {
clearAnimationTimeout();
contentClassList().add(refreshClass);
timeoutId = setTimeout(() => {
contentClassList().remove(refreshClass);
clearAnimationTimeout();
}, timeout);
const content = document.querySelector(".o_content");
if (content) {
content.classList.add(refreshClass);
timeoutId = setTimeout(() => {
// Check if element still exists in DOM after timeout
if (
document.contains(content) &&
content.classList.contains(refreshClass)
) {
content.classList.remove(refreshClass);
}
clearAnimationTimeout();
}, timeout);
}
}
return animate;