Page MenuHomePhabricator

Mentor tools: Clicking the Pause button causes the submission to happen multiple times
Closed, ResolvedPublic

Description

Found by Elena at T280307#7473617.

(2) Multiple clicks on the Pause button produce multiple error messages. Even for a valid input, the multiple clicks will display the error message (much harder to reproduce than with the empty text field).

Screen Shot 2021-11-01 at 6.42.12 PM.png (1×2 px, 390 KB)

The submission should only happen a single time for a single dialog, both to not make the API do one thing multiple times, and to avoid multiple error messages displayed.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 737707 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] AwaySettingsDialog: Close the dialog before API request finishes

https://gerrit.wikimedia.org/r/737707

The patch fixes this by closing the away dialog early. But maybe that'll be noticeable on slower connections (where the notification about status change will be significantly delayed)? I can try to prevent the API call being executed more than once with same parameters.

@Etonkovidova Do you have any opinion on this?

Putting to CR, as the submited patch will fix the issue – I'm merely not sure if that's the correct/best way to do it.

Urbanecm_WMF raised the priority of this task from Lowest to Low.
Urbanecm_WMF moved this task from Backlog to In review on the User-Urbanecm_WMF (Engineering) board.

Another option could be to return a promise as the step in the OOUI Process returned in AwaySettingsDialog.prototype.getActionProcess that resolves/rejects when the API call is completed. Since the dialog is an OOUI ProcessDialog, the loading state of the dialog will be shown and the buttons are disabled automatically. This might help address the concern that the user could unknowingly close the browser tab before the request completes.

Screen Shot 2021-11-09 at 10.55.15 AM.png (538×1 px, 103 KB)

Change 738190 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] AwaySettingsDialog: Return a promise when saving

https://gerrit.wikimedia.org/r/738190

Another option could be to return a promise as the step in the OOUI Process returned in AwaySettingsDialog.prototype.getActionProcess that resolves/rejects when the API call is completed. Since the dialog is an OOUI ProcessDialog, the loading state of the dialog will be shown and the buttons are disabled automatically. This might help address the concern that the user could unknowingly close the browser tab before the request completes.

Screen Shot 2021-11-09 at 10.55.15 AM.png (538×1 px, 103 KB)

That's even better, thanks! {{done}}.

Change 737707 abandoned by Urbanecm:

[mediawiki/extensions/GrowthExperiments@master] AwaySettingsDialog: Close the dialog before API request finishes

Reason:

in favor of 738190

https://gerrit.wikimedia.org/r/737707

Change 738190 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] AwaySettingsDialog: Return a promise when saving

https://gerrit.wikimedia.org/r/738190

Checked on testwiki wmf.9 - works as expected.