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've seen this myself several times during batch translations (100 sentences per session). Frequency of this bug appears to be 1 or 2 out of 100 translations. So, I guess it has some race condition issue behind it which means that the bug should be fixed more by elaborate analysis rather than by reproduction.
I'll try to do it.
Looks like some echo from bug that unbind() on app/webroot/js/sentences.add_translation.js:35 was called to fix. When I commented it down, I got 6 instances of the sentence added. Looks like the second click sometimes occurs before unbind is run, which causes double request. I think unbinding isn't a stable solution - we have to hold registry of currently active requests and if second request arrives while another one is still active, discard it.
Yes the reason was related to 'unbind()' but in a little different way. Actually, the original bug description provided a way to reproduce this bug with 100% guarantee:
Cela arrive quand vous pressez le bouton «traduire» deux fois par mégarde. Une fois, j’en ai eu quatre, ces doubles.
Initially I thought that the author intended the button "Submit translation" with «traduire» but now I see that he/she meant the button that opens the translation controls - if you click the translate button while the controls are already open, you get second instances of event handlers bound to buttons and textarea so, when pressing the button you get two calls (that are execute both even though unbind is called in the first one). This can be worked around by the registry I mentioned, but it's easier to unbind event handlers immediately before binding them.
Reported by GrizaLeono, Wezel and soweli_Elepanto on the Wall:
The text was updated successfully, but these errors were encountered: