Skip to content

Commit

Permalink
fix(ui): loading animation stay infinitely on
Browse files Browse the repository at this point in the history
Fixes #3791
  • Loading branch information
robertsLando committed Jul 22, 2024
1 parent 0eb63a7 commit 3bcbd8b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lib/axios-progress-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 3bcbd8b

Please sign in to comment.