axios-module: progress: false does not work in version 5.5.3
Version
Reproduction link
https://codesandbox.io/s/8n6z6z30j8
Steps to reproduce
Add progress: false in request config:
this.$axios.get('URL', { progress: false });
this.$axios.post('URL', { data: 'data' }, { progress: false });
What is expected ?
progress bar is not displayed
What is actually happening?
Progress bar displayed for all types of requests (get, post, patch, delete)
Additional comments?
in version 5.3.6 it works correctly
<div align="right">This bug report is available on Nuxt community (#c255)</div>About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 23
- Comments: 15 (3 by maintainers)
Still not working in 5.6.0
I did some digging and found that this might indeed be the result of an update in axios. But more in the sense that it shouldn’t have worked in earlier versions of this module.
When doing any axios request, axios creates a generic config file to create a request (see: https://github.com/axios/axios/blob/master/lib/core/mergeConfig.js)
It does not include the
progresskey. The axios onRequest hook that this module uses (see: https://github.com/nuxt-community/axios-module/blob/master/lib/plugin.js, line 108), expects that it does.Creating a plugin as such:
Shows that it is always
undefined(as could be expected), so the testconfig && config.progress === falsealways fails.I was unable to find a way to pass custom data to the axios config as of yet. For now this ugly fix worked:
Axios updated. Should be fixed with v5.9.3 .
In a plugin
And I still have the progress bar synced with my asyncData.
Otherwise you can pass it as an argument to your resquest:
$axios.$get(url, { progress: false })Hi, I think this is related, the progress bar is reset for each request. Instead of getting a single progress bar for all the request in asyncData, the progress bar is reset for each request (using await) which is not ideal and very ugly. I created an .onRequest interceptor to disable (progress: false) globally and now it works like intended.
@delanoflipse described the problem quite well, it is an axios issue however. A fix came with https://github.com/axios/axios/pull/2207 but a release is still pending.
You can either wait or downgrade axios (or use a workaround described in this thread).
Update
Looks like there was a regression and the update isn’t out yet due to it. See https://github.com/axios/axios/pull/2207#issuecomment-529163362
I use v5.5.4 have same question. And use v5.5.2 work fine.
@tomshaw This solution completely disables the progress bar and it is not suitable if you need to disable the progress bar only for part of the requests