2

I am having trouble pinpointing why some of my state store dispatches after async REST calls are sometimes not being fired. One thing I notice is in the network panel, I will often get an

xhr (cancelled) initiated by zone.js

Anybody know what triggers the cancellation and what it means?

Much thanks!

user2410939
  • 195
  • 1
  • 1
  • 7
  • 1
    are you using RxJS? for example using SwitchMap can cause cancellation and it is a good feature to reduce resource usage – Mahmood Sajjadi Apr 25 '17 at 01:49
  • I encountered the problem too. Do you figure out the cause? – Roy Ling Apr 25 '17 at 04:06
  • @MahmoodSajjadi I am using `map` operator, assuming that there's no resource reduction, right? – Roy Ling Apr 25 '17 at 04:07
  • map is just transforming your stream to another stream, for example is you transforming click_event stream to http by click then you will not canceling any http call, but maybe you want to cancel other http calls and only keep the last one, switch map will do it for you if you do it correctly, and also when you http compleate, with map, your observable will die, but with switch map, your observable will be remain, becuse it is a switch. if you put your code in a new question, me or some one else can take a look and help you – Mahmood Sajjadi Apr 25 '17 at 13:08

0 Answers0