From 3bcbd8b6c9e642828fec6aa38ecb467ae9448fcb Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Mon, 22 Jul 2024 17:33:29 +0200 Subject: [PATCH] fix(ui): loading animation stay infinitely on Fixes #3791 --- src/lib/axios-progress-bar.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/axios-progress-bar.js b/src/lib/axios-progress-bar.js index 5120483a5b..7afa0a19b6 100644 --- a/src/lib/axios-progress-bar.js +++ b/src/lib/axios-progress-bar.js @@ -19,6 +19,13 @@ export default function loadProgressBar(config, instance = axios) { const update = (e) => { const { loaded, total } = e + // for some reason (maybe a race condition) seems we can get + // events emitted even when request is already closed + // fixes #3791 + if (requestsCounter === 0) { + return + } + // sometimes `total` is undefined, in that case simply call `inc` without params if (loaded !== undefined && total !== undefined) { NProgress.set(calculatePercentage(loaded, total))