Ranter
Join devRant
Do all the things like
				++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
				Sign Up
			Pipeless API
				From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
				Learn More
			Comments
		- 
				
				So you actually mean recursive Promise in the actual sense of recursive or just nested?
 - 
				
				
msdsk30786y@don-rager
@magicMirror
recursive, unfortunately. Google API, I'm getting in a response a next page token; after that I need to wait a moment for the token to become valid (fun fact, the time length is not documented) and then I can resend the previous request, this time with the token to get the next page, repeating for as long as I am receiving a new token back, so it actually needs to call itself again. - 
				
				Considering breaking token handling and resolution into a separate piece to reduce mental complexity and make them testable in isolation.
The interceptor pattern is an excellent option for this sort of thing:
https://en.m.wikipedia.org/wiki/... - 
				
				
msdsk30786y@SortOfTested
Thank you! I managed to simplify it a great deal by just cleaning up code, now I'm back to struggling with the library! 
Related Rants

What only relying on JavaScript for HTML form input validation looks like
Found something true as 1 == 1
I got to a point where I have a multi-level recursive promises within loops and my mental map is by far not enough to process this. I wish there were some visualisation tools for this - though I don't even know how it could look like. All I know is that at some point I'm returning a wrong promise and the recursion is not correctly handled.
rant
js
callback hell
promises