Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Using the ajax $.active does not decrement with 422 responses #336

Open
@cibernox

Description

@cibernox

$.active is a well-known trick to discover how many pending ajax request there is on a page. Most commonly used in testing.

It turns out that refactoring a $.ajax into this.get('ajax').request broke my tests because when an 422 response is received, a InvalidError is thrown from the jqXHR.done callback, preventing the normal behavior of $.active

Background about the bug in jQuery: https://bugs.jquery.com/ticket/11207

I believe that moving from done/fail to a wrapped promise + then/catch might fix the issue, but I haven't had time to check it. I leave my thoughts here and I'll try to investigate it further another day.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions