Page MenuHomePhabricator

[wmf.6] Add link: post-edit dialog displayed twice
Closed, ResolvedPublic

Description

Note: the issue is not present in betalabs

  1. On testwiki wmf.5 go to an article with suggested Add link tasks.
  2. Answer 'No' and submit the change.

There will be two post-edit dialogs displayed - one over another. In the post-edit dialog click on 'Close' or on the 'x' button - the overlapped dialogs will be closing one after another:

double_post_edit2.gif (899×1 px, 964 KB)

Event Timeline

Etonkovidova renamed this task from [wmf.6]Add link- post-edit dialog displayed twice to [wmf.6]Add link: post-edit dialog displayed twice .May 19 2021, 1:40 AM
kostajh triaged this task as High priority.May 25 2021, 1:07 PM

I can't reproduce this. @Etonkovidova does this happen for you deterministically? If yes, what browser/OS? If no, did you do anything special before saving the page?

(Testwiki is on wmf.7 now so maybe it just got fixed accidentally.)

I just reproduced this on testwiki with Firefox 89 on macOS. I went to an article, pressed "No" on the first suggestion, then "Submit".

There are four events:

{
	"$schema": "/analytics/legacy/newcomertask/1.0.0",
	"client_dt": "2021-05-25T20:51:54.151Z",
	"event": {
		"has_image": false,
		"maintenance_templates": [],
		"newcomer_task_token": "da65a25880e155bc4736",
		"ordinal_position": 0,
		"page_id": 114855,
		"page_title": "Space policy of the United States",
		"pageviews": 1,
		"revision_id": 449881,
		"task_type": "link-recommendation"
	},
	"meta": {
		"domain": "test.wikipedia.org",
		"stream": "eventlogging_NewcomerTask"
	},
	"schema": "NewcomerTask",
	"webHost": "test.wikipedia.org",
	"wiki": "testwiki"
},
{
	"$schema": "/analytics/legacy/helppanel/1.0.1",
	"client_dt": "2021-05-25T20:51:54.151Z",
	"event": {
		"action": "postedit-impression",
		"action_data": "type=full;savedTaskType=link-recommendation;userTaskTypes=link-recommendation;newcomerTaskToken=da65a25880e155bc4736",
		"context": "postedit",
		"editor_interface": "visualeditor",
		"help_panel_session_id": "2d473a1d2a7ec911e4e8",
		"is_mobile": false,
		"is_suggested_task": true,
		"page_id": 0,
		"page_ns": 0,
		"page_protection": "",
		"page_title": "",
		"session_token": "d7dc1b17d7aec9cd9fbe",
		"user_can_edit": true,
		"user_editcount": 101,
		"user_id": 40269
	},
	"meta": {
		"domain": "test.wikipedia.org",
		"stream": "eventlogging_HelpPanel"
	},
	"schema": "HelpPanel",
	"webHost": "test.wikipedia.org",
	"wiki": "testwiki"
}

and:

{
	"$schema": "/analytics/legacy/newcomertask/1.0.0",
	"client_dt": "2021-05-25T20:51:54.631Z",
	"event": {
		"has_image": false,
		"maintenance_templates": [],
		"newcomer_task_token": "ecd49165547a148a4ee1",
		"ordinal_position": 0,
		"page_id": 113866,
		"page_title": "Mosquito (film)",
		"pageviews": 1,
		"revision_id": 448046,
		"task_type": "link-recommendation"
	},
	"meta": {
		"domain": "test.wikipedia.org",
		"stream": "eventlogging_NewcomerTask"
	},
	"schema": "NewcomerTask",
	"webHost": "test.wikipedia.org",
	"wiki": "testwiki"
},
{
	"$schema": "/analytics/legacy/helppanel/1.0.1",
	"client_dt": "2021-05-25T20:51:54.631Z",
	"event": {
		"action": "postedit-impression",
		"action_data": "type=full;savedTaskType=link-recommendation;userTaskTypes=link-recommendation;newcomerTaskToken=ecd49165547a148a4ee1",
		"context": "postedit",
		"editor_interface": "visualeditor",
		"help_panel_session_id": "2d473a1d2a7ec911e4e8",
		"is_mobile": false,
		"is_suggested_task": true,
		"page_id": 0,
		"page_ns": 0,
		"page_protection": "",
		"page_title": "",
		"session_token": "d7dc1b17d7aec9cd9fbe",
		"user_can_edit": true,
		"user_editcount": 101,
		"user_id": 40269
	},
	"meta": {
		"domain": "test.wikipedia.org",
		"stream": "eventlogging_HelpPanel"
	},
	"schema": "HelpPanel",
	"webHost": "test.wikipedia.org",
	"wiki": "testwiki"
}

I suspect this is probably some fallout from T281462: Prevent link suggestions from appearing again after publishing an edit and the window reloading code there?

I can reproduce with Firefox but not with Chrome. Some timing difference I guess?

The bandaid approach would be to prevent the postedit dialog from opening if it's already open.

Change 695355 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/extensions/GrowthExperiments@master] Add Link: Prevent double-opening of the post-edit dialog

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

There are four vectors for showing the post-edit dialog:

  • when the suggested edit session is initialized, if showPostEditDialog() has been called but the dialog has not been shown (presumably on a previous pageview, because VE or our code reloaded the page)
  • from the postEdit / postEditMobile hook
  • when the save dialog is closed. This is needed when the edit was a null edit (only rejections) and thus the postEdit hook wasn't called. Ideally we'd only show the dialog in that case but there is no obvious way to tell at that point.
  • When the "skipped all" dialog is accepted (closed with the skip option).

As far as I can see the only way to get a double dialog is if showPostEditDialog() is called again when it's open (or at least opening it has been initiated with the OOUI window manager). In the scenario where one only selects "No", the second and fourth code branches shouldn't be hit, and there is no page reload. So I'm not sure how this can happen (and I can't reproduce it locally, even in Firefox, although I can on testwiki); going for the bandaid option.

Change 695436 had a related patch set uploaded (by MewOphaswongse; author: Gergő Tisza):

[mediawiki/extensions/GrowthExperiments@wmf/1.37.0-wmf.6] Add Link: Prevent double-opening of the post-edit dialog

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

Change 695437 had a related patch set uploaded (by MewOphaswongse; author: Gergő Tisza):

[mediawiki/extensions/GrowthExperiments@wmf/1.37.0-wmf.7] Add Link: Prevent double-opening of the post-edit dialog

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

Change 695355 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Add Link: Prevent double-opening of the post-edit dialog

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

Etonkovidova renamed this task from [wmf.6]Add link: post-edit dialog displayed twice to [wmf.6] Add link: post-edit dialog displayed twice .May 26 2021, 11:40 PM

I can reproduce with Firefox but not with Chrome. Some timing difference I guess?

The bandaid approach would be to prevent the postedit dialog from opening if it's already open.

The issue is not reproducible sometime in chrome, yes. I just re-checked in testwiki (the patch is not there yet): double-click on 'Submit' will reliably reproduce it on Chrome, so checked (in betalabs) that the fix applies to that scenarios also - it does.

Change 695436 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@wmf/1.37.0-wmf.6] Add Link: Prevent double-opening of the post-edit dialog

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

Change 695437 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@wmf/1.37.0-wmf.7] Add Link: Prevent double-opening of the post-edit dialog

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

Mentioned in SAL (#wikimedia-operations) [2021-05-27T12:39:17Z] <tgr@deploy1002> Synchronized php-1.37.0-wmf.6/extensions/GrowthExperiments/: Backport: [[gerrit:695436|Add Link: Prevent double-opening of the post-edit dialog (T283120)]] [[gerrit:695437|Add Link: Prevent double-opening of the post-edit dialog (T283120)]] (duration: 01m 06s)

Mentioned in SAL (#wikimedia-operations) [2021-05-27T12:40:41Z] <tgr@deploy1002> Synchronized php-1.37.0-wmf.7/extensions/GrowthExperiments/: Backport: [[gerrit:695437|Add Link: Prevent double-opening of the post-edit dialog (T283120)]] [[gerrit:695479|Always delete from search index in AddLinkSubmissionHandler (T283606)]] (duration: 01m 06s)