Skip to content
Advertisement

RangeError: Maximum call stack size exceeded (getting this error on multiple async/await calls)

RangeError: Maximum call stack size exceeded

On using multiple async/await i am getting error RangeError: Maximum call stack size exceeded

I think the stack size is fulled on calling so many async functions but if not so how do i achieve same functionality that this code would have achieved if it doesn’t get any error

Code attached below:

JavaScript

Advertisement

Answer

Your code is nice and legible, but even so, it’s a little bit hard to tell what you’re going for:

A major issue is that the function you define called “fetch” (side note: shadowing variable names is frowned upon), is not returning a variable or setting state (so it’s not really doing anything).

Another issue is that updateRides in your fetch function will be stale (have the initial value, not the one set by fetchRides). That may mean you’re looping over data in a different format (or at least different values) than you’re expecting.

I think this might be a little closer (let me know if it’s not and I can update):

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement