Angularjs aborted promises still delay other promises -
i posted this question , figured out direct solution (that being, able cancel promise/request when route changed). however, i'm encountering another, related problem think belongs in separate question here goes:
i'm able abort promise when route changes fine (as can see question linked). however, strange reason, other requests on other route delayed when resolving. see dev tools screenshot below.
here's scenario: load route a, makes call /api/categories
, can see takes 30ms normal. navigate route b, before it's done loading return route a. when return, call /api/categorysites/1
cancelled, , can see when happens gray bar ends. done aborting promise. however, on route again, call /api/categories
doesn't resolve until gray dot appears again on request cancelled. second call /api/categories
shouldn't take 2.23s, should closer 30ms.
what's going on here? think second route request fast before. need work faster. code in this question. let me know if think should include again here. it's hard me imagine isn't common problem too...
this older post did , sounds eager vs. lazy asynch transition read in emberjs documentation recently. on routes (and subsequent aborts) fulfills promise (completes), moves along re-route request.
i believe can improved state controller.
there angularjs ui-router state controller might of use.
angularjs routing documentation (for posterity).
so $routeprovider
(angularjs default) enhanced $stateprovider
(ui-router) expedite aborted routes.
hope helpful (roughly 312 days later).
Comments
Post a Comment