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
I think @treznick and I found a race condition between remotipart and jquery-ujs that is preventing buttons from being disabled ala data-disable-with, added in issue #31.
In development, we see UJS disable the buttons, then re-enable them on the ajax:aborted:file event, and then remotipart re-disables them for the ajax file upload.
But in production, UJS disables the buttons, then remotipart re-disables them, and then UJS enables them. It appears to the user that the buttons are never disabled.
Changing the remotipart setTimeout delay for re-disabling the buttons to 40ms, like so:
setTimeout(function(){$.rails.disableFormElements(form);},40);// old timeout was 20
...seems to fix the race condition, but this seems like a brittle solution.
Our problem feels very similar to #338, but not quite the same.
Is there a better way to guarantee the order?
The text was updated successfully, but these errors were encountered:
Update: as of now, we have our own series of setTimeout callbacks at something like 10, 30, and 200ms, to re-disable the buttons, as long as there's a 'pending' flag on the form (which we're adding when the form is submitted, and removing when the response comes in). It's sloppy, but it works.
Would love to hear thoughts on fixing the core issue. Anything we can do to help?
Hi,
I think @treznick and I found a race condition between remotipart and jquery-ujs that is preventing buttons from being disabled ala
data-disable-with
, added in issue #31.In development, we see UJS disable the buttons, then re-enable them on the ajax:aborted:file event, and then remotipart re-disables them for the ajax file upload.
But in production, UJS disables the buttons, then remotipart re-disables them, and then UJS enables them. It appears to the user that the buttons are never disabled.
Changing the remotipart setTimeout delay for re-disabling the buttons to 40ms, like so:
...seems to fix the race condition, but this seems like a brittle solution.
Our problem feels very similar to #338, but not quite the same.
Is there a better way to guarantee the order?
The text was updated successfully, but these errors were encountered: