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
Interceptors array potentially growing indefinitely #1380
Comments
Hello, Deleting keys instead of just putting null could help a little but it would just create sparse arrays, I'm not sure this is much better. Maybe using a plain object to store the interceptors and another array to know in which order call the interceptor could work ( I don't think relying on keys order in object is a good idea, it's only sure to work in ES6 compliant implementation) |
And reusing nulled index instead of returning directly the last one in |
Wouldn't that change the order of execution of interceptors? The more I think about it, the more I'd say that using just an object to store the interceptors could actually be a good idea. |
Ok, order is important... maybe, a |
Yes, that seems like the best idea. That's kind of what I was suggesting but with a plain JS object to make sure it will be ES5 compatible |
possible solution to axios#1380 ?
Hi! |
@Axnyff Using plain JS object(Map implementation) looks good approach. is there any update/plan to implement it ? |
You have no guarantee that order of insertion is respected with plain js objet. |
We could have used |
ES5 compatible? See #1380 (comment) where @Axnyff suggests object + array |
My PR should work with only an id and a count: #1410 |
Hi, Please read more on this issue over at #1914 Thanks |
Hi,
While testing my application, i notice that the
handlers
array of axios interceptors only increase, even if i use theeject
method.In fact,
eject
only nullify interceptor entryaxios/lib/core/InterceptorManager.js
Line 32 in a105872
and
use
always push new handler and returnlength - 1
axios/lib/core/InterceptorManager.js
Line 22 in a105872
Is it not dangerous (or expensive) to have this type of behaviors?
Regards
The text was updated successfully, but these errors were encountered: