Page MenuHomePhabricator

[betalabs] Add link: switching to source editor results in persistent page re-loading
Closed, ResolvedPublic

Description

  1. A user goes to Suggested link article and switches to the source editor.
  2. When the source editor finish loading - click to switch back to VE.

The page starts reloading and it goes indefinitely (see the gif below):

infinite_loop.gif (659×1 px, 481 KB)

Not sure if the lines from the Console are relevant:

[Violation] 'requestAnimationFrame' handler took 56ms
load.php?lang=en&modules=jquery%2Coojs-ui-core%2Coojs-ui-widgets|jquery.ui&skin=vector&version=s8882:49 [Violation] 'setTimeout' handler took 448ms
[Violation] Forced reflow while executing JavaScript took 296ms
load.php?lang=en&modules=jquery%2Coojs-ui-core%2Coojs-ui-widgets|jquery.ui&skin=vector&version=s8882:49 [Violation] 'setTimeout' handler took 81ms
load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector:23 [Violation] 'requestIdleCallback' handler took 127ms

It seems to complain about these lines:

function getCombinedVersion(modules) {
                    var hashes = modules.reduce(function(result, module) {
                        return result + registry[module].version;
                    }, '');
                    return fnv132(hashes);

Note: Currently editor default setting in Preferences - "Remember my last editor". That means - just switching to the editor makes that editor "the last editor" used. If a newcomer switches to the source editor, the Suggestion mode will be lost. Since the VE dialog is suppressed, it might be even more difficult for users to figure out how to get back to the the Suggestion mode.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
kostajh triaged this task as Medium priority.Apr 20 2021, 12:37 PM
kostajh moved this task from Backlog to April 26 - April 30 on the Add-Link board.

Also related, clicking on "View history" will take you back to Suggestions mode.

This seems to be caused by my changes to open edit mode via JS

			if ( suggestedEditSession.shouldOpenArticleInEditMode && $editLink.length ) {
				uri = new mw.Uri();
				if ( uri.query.section ) {
					$editLink.attr(
						'href',
						uri.clone().extend( { section: uri.query.section } )
					);
				}
				$editLink[ 0 ].click();
			}

When View History is clicked and suggestedEditSession is restored, shouldOpenArticleInEditMode is still true so this block is called again when it shouldn't be.

Change 683410 had a related patch set uploaded (by MewOphaswongse; author: MewOphaswongse):

[mediawiki/extensions/GrowthExperiments@master] Add a link: Fix persistent page reloading when switching tabs

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

Change 683410 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Add a link: Fix persistent page reloading when switching tabs

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