canjs / can-zone

A context for tracking asynchronous activity in JavaScript applications.
https://v4.canjs.com/doc/can-zone.html
MIT License
91 stars 4 forks source link

Add onloadend handler for zoned XHRs #197

Closed bmomberger-bitovi closed 1 year ago

bmomberger-bitovi commented 1 year ago

Axios subscribes to the onloadend handler on XHRs rather than the onload or onreadystatechange handler, which causes problems if an XHR request has been intercepted by can-zone. The XHR zone does not currently fire this handler when pulling a response out of XHR_CACHE.

This PR adds onloadend to the callbacks fired in the XHR zone to fix the above issue.