Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onDownloadProgress changed after 1.6.8 #6417

Open
Fedec96 opened this issue May 23, 2024 · 4 comments · May be fixed by #6438
Open

onDownloadProgress changed after 1.6.8 #6417

Fedec96 opened this issue May 23, 2024 · 4 comments · May be fixed by #6438
Labels
status::confirmed This issue or pull request has been confirmed by a project maintainer

Comments

@Fedec96
Copy link

Fedec96 commented May 23, 2024

Describe the bug

It appears that, starting from 1.7.0, onDownloadProgress's event doesn't fully complete: seems like the callback is not called upon the very last chunk. In fact, I use the event to expose the file transfer's percentage and it never reaches the 100%. It always stops between 98 and 99, but this problem never occurs with <= 1.6.8.

To Reproduce

Apologies, I cannot provide the URL to the 13 MB file, but here's the code and the output for 1.6.8 and 1.7.0+:

import axios from "axios";

axios<Blob>("...", {
  responseType: "blob",
  onDownloadProgress: (event) => console.log(event),
})
  .then(() => {
    /* ... */
  })
  .catch(() => {
    /* ... */
  });

This is what the console logs up to 1.6.8...

// First log
{
    "total": 13521971,
    "loaded": 8192,
    "progress": 0.0006058288395974226,
    "bytes": 8192,
    "event": { "isTrusted": true },
    "download": true
}

// ...somewhere in the middle...
{
    "total": 13521971,
    "loaded": 10081518,
    "progress": 0.7455657167139317,
    "bytes": 167936,
    "rate": 2928625,
    "estimated": 1.174767339621836,
    "event": { "isTrusted": true },
    "download": true
}

// Last log
{
    "total": 13521971,
    "loaded": 13521971,
    "progress": 1,
    "bytes": 208709,
    "rate": 3200495,
    "estimated": 0,
    "event": { "isTrusted": true },
    "download": true
}

...and this is what logs from 1.7.0 on:

// First log
{
    "total": 13521971,
    "loaded": 12279,
    "progress": 0.0009080776759541934,
    "bytes": 12279,
    "event": { "isTrusted": true },
    "lengthComputable": true,
    "download": true
}

// ...somewhere in the middle...
{
    "total": 13521971,
    "loaded": 5598458,
    "progress": 0.41402677168883145,
    "bytes": 94208,
    "rate": 1368536,
    "estimated": 5.789773159054639,
    "event": { "isTrusted": true },
    "lengthComputable": true,
    "download": true
}

// Last log
{
    "total": 13521971,
    "loaded": 13397242,
    "progress": 0.9907758269855778,
    "bytes": 335872,
    "rate": 1289121,
    "estimated": 0.09675507574541102,
    "event": { "isTrusted": true },
    "lengthComputable": true,
    "download": true
}

Code snippet

No response

Expected behavior

No response

Axios Version

1.7.0+

Adapter Version

No response

Browser

No response

Browser Version

No response

Node.js Version

No response

OS

No response

Additional Library Versions

No response

Additional context/Screenshots

No response

@DigitalBrainJS DigitalBrainJS added the status::confirmed This issue or pull request has been confirmed by a project maintainer label May 23, 2024
@tbl0605
Copy link

tbl0605 commented May 29, 2024

Hi,
same problem for me with version 1.7.1 (using latest versions of Chrome on Windows 10).
In my case the problem occurs randomly and more often with slow connections.

I can confirm that rolling back to 1.6.8 fixes the issue.

@sssanwar
Copy link

I confirm I have the same problem with version 1.7.2 on Firefox.

@gepbird
Copy link

gepbird commented Jun 2, 2024

Same issue starting from 1.7.0-beta.0 using `onUploadProgress.

Also the frequency of onUploadProgress reports decreased from ~20 report/sec to ~4 report/sec.

@chitoku-k chitoku-k linked a pull request Jun 8, 2024 that will close this issue
@Asdreu
Copy link

Asdreu commented Jun 13, 2024

I have same problem in chrome when i use onUploadProgress, axios version is 1.7.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status::confirmed This issue or pull request has been confirmed by a project maintainer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants