There is quite popular pattern to check if ajax request has finished for jquery
def finished_all_ajax_requests?
return if page.evaluate_script('jQuery.active').blank?
page.evaluate_script('jQuery.active').zero?
end
Is there any equivalent of this snippet for @rails/ujs, I'm trying to check it for the remote form which is triggered from the modal, it also uses stimulujs ajax callbacks.
No. UJS just creates standard XMLHttpRequest objects and doesn't keep a count of them. You shouldn't have been depending on this type of functionality previously and should instead be setting expectations on the visible page changes that occur when your requests have completed. Test what a user does and sees.