question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove `axios.all` and `axios.spread`

See original GitHub issue

Those helpers can easily be replaced with native features (Promise.all and ES6 parameter destructuring) or specialized libraries, so we should restrict our API to HTTP-related methods.

We can deprecate them in 0.x and completely remove then in 1.0.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:51
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

119reactions
qm3stercommented, Sep 22, 2017

Should the following in the README example:

axios.all([getUserAccount(), getUserPermissions()])
  .then(axios.spread(function (acct, perms) {
    // Both requests are now complete
  }));

be replaced with this instead:

Promise.all([getUserAccount(), getUserPermissions()])
  .then(function ([acct, perms]) {
    // Both requests are now complete
  });

or this:

const [acct, perms] = await Promise.all([getUserAccount(), getUserPermissions()])
// Both requests are now complete
34reactions
rubennortecommented, Aug 24, 2017

Axios uses Promise.all under the hood so you must be polyfilling it already.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use the axios.spread function in axios - Snyk
To help you get started, we've selected a few axios examples, based on popular ways it is used in public projects. ; return...
Read more >
Axios/Vue - Prevent axios.all() to keep executing
In my application wile authenticating the user I call the fetchData function. If the user token become invalid, the application will run axios....
Read more >
Using axios.all to make concurrent requests - LogRocket Blog
axios.all is a helper method built into Axios to deal with concurrent requests. Instead of making multiple HTTP requests individually, ...
Read more >
How to Use axios.all() to Make Concurrent HTTP Requests
Here's how you can use `axios.all()` to make multiple HTTP requests ... your code more readable as axios.all() takes a spread of requests....
Read more >
Axios Cheat Sheet - Kapeli - Dash for macOS
Make a request for a user with a given ID axios.get('/user? ... axios.get('/user/12345/permissions'); } axios.all([getUserAccount(), getUserPermissions()]) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found