1
0
mirror of synced 2024-11-25 06:16:08 +03:00

Attempt to detect aborted requests

The error handler should not be raised if a request is aborted while
another one is sent out. This attempts to detect those cases by
handling the case where the error was raised and the request has a
status code of 0, which should either mean we're in offline mode or
the request was aborted.

This closes https://github.com/select2/select2/issues/4205
This commit is contained in:
Kevin Brown 2016-03-27 15:44:40 -04:00
parent fe26b083eb
commit cfb66f5e4f

View File

@ -80,6 +80,12 @@ define([
callback(results);
}, function () {
// Attempt to detect if a request was aborted
// Only works if the transport exposes a status property
if ($request.status && $request.status === '0') {
return;
}
self.trigger('results:message', {
message: 'errorLoading'
});