Rxjs: AjaxObservable: does not error when aborted

Created on 12 Oct 2018  路  3Comments  路  Source: ReactiveX/rxjs

Bug Report

Copied from https://github.com/ReactiveX/rxjs/pull/4105

Current Behavior
It is possible for an XHR to be aborted externally, for example when the machine loses connectivity, or when the machine is sent to sleep.

Currently, when the XHR is aborted in this way, the observable does not error and the subscription remains.

Reproduction

import { ajax } from 'rxjs/ajax'

ajax.get('https://httpbin.org/delay/10').subscribe();

Whilst request is pending, send machine to sleep.

When machine is woken, request is aborted, but observable did not error.

Expected behavior
In this case, I think we would want to error the observable? Although it might also be useful to emit something to indicate it was aborted.

Environment

  • Runtime: all envs that support AjaxObservable
  • RxJS version: 6.3.3

Possible Solution

Additional context/Screenshots

Most helpful comment

Also got this error after sleep/wake in Chrome, request was cancelled but Observable wasn't errored & wasn't completed, just stuck.

How this was handled in Axios - https://github.com/axios/axios/pull/1399

All 3 comments

I guess error would be appropriate. (at least way I did is emitting error, like https://github.com/kwonoj/oxid/blob/master/src/adapters/xhr.ts#L233)

Also got this error after sleep/wake in Chrome, request was cancelled but Observable wasn't errored & wasn't completed, just stuck.

How this was handled in Axios - https://github.com/axios/axios/pull/1399

It would be grateful if there is any news about this issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

peterbakonyi05 picture peterbakonyi05  路  4Comments

unao picture unao  路  4Comments

slikts picture slikts  路  4Comments

dooreelko picture dooreelko  路  3Comments

Zzzen picture Zzzen  路  3Comments