You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
$.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
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.
The text was updated successfully, but these errors were encountered:
Is there a reason your tests are relying on $.active? If the issue is needing to "wait" until your requests are finished, that should "just work" based on some of the compatibility code we have in the addon.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
$.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
intothis.get('ajax').request
broke my tests because when an 422 response is received, aInvalidError
is thrown from thejqXHR.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.The text was updated successfully, but these errors were encountered: