Closed RyanMilligan closed 5 years ago
Gitter conversation: https://gitter.im/canjs/canjs?at=5c01a23e9aec405095a8bea1
@RyanMilligan confirmed can-fixture isn't being loaded: https://gitter.im/canjs/canjs?at=5c01bb5043c68b3727ddbaf7
@phillipskevin @RyanMilligan what should fixed for this issue and what is the expected behavior?
xhr.open that we call here: https://github.com/canjs/can-ajax/blob/d5241b027ac2b44ec83e7014c89db2eccda72af6/can-ajax.js#L217
Is supposed to default the async
parameter to true
.
Which means that the promise
should be returned here before the response to send
is received:
https://github.com/canjs/can-ajax/blob/d5241b027ac2b44ec83e7014c89db2eccda72af6/can-ajax.js#L257-L258
@RyanMilligan found that this is not always happening, so we should try to verify this and then explicitly pass true
as the async
parameter if required.
@phillipskevin Maybe we should async
params to the options list if is not set it will be true
.
I don't think it really makes sense to have the option to pass async: false
, since ajax
will still return a function.
I think we just add a test that checks that true
is passed to open
and pass it explicitly.
The exact circumstances are unknown, but sometimes, when running in Chrome, calling
xhr.open()
without passing anasync
value results in a synchronous network call. This can be solved by explicitly passingtrue
.