Page MenuHomePhabricator

Retried-load results in document showing twice
Closed, ResolvedPublic

Description

If the article fails to load, we give the user the option to retry:

image.png (164×334 px, 15 KB)

If the second try succeeds, we show the read mode and the edit beneath it:

image.png (722×643 px, 105 KB)

A retry loop can be tested with the following patch:

diff --git a/modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js b/modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js
index c129712fb..e640a7d61 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js
@@ -354,7 +354,8 @@ ve.init.mw.ArticleTarget.prototype.loadSuccess = function ( response ) {
        var mode, section,
                data = response ? ( response.visualeditor || response.visualeditoredit ) : null;
 
-       if ( !data || typeof data.content !== 'string' ) {
+       if ( !this.retried ) {
+               this.retried = true;
                this.loadFail( 've-api', 'No HTML content in response from server' );
        } else if ( response.veMode && response.veMode !== this.getDefaultMode() ) {
                this.loadFail( 've-mode', 'Tried to load "' + response.veMode + '" data ' +

Event Timeline

Looks like the ve-active class isn't added to the body. This is the one that hides the read article.

Change 550858 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/VisualEditor@master] Don't reject activatingDeferred on loadFail

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

I've seen bug reports in the past where VE was loaded along side other content, such as the classic WikiEditor, and I imagine this is the cause. Do you remember these @Whatamidoing-WMF ?

I vaguely recall a case where a similar problem was caused by unbalanced HTML in some overridden localisation message (it would have caused the WT editor to be inside the wrong element, and therefore not be hidden), but I can't find that task either.

Change 550858 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Don't reject activatingDeferred on loadFail

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

Reproduction steps (without messing with the code, and without the server being broken somehow, which is the usual cause of failed loading):

  1. Open a page in read mode
  2. Open the editor
  3. Close the editor without reloading the page (e.g. press Escape key on the keyboard)
  4. In your browser's developer tools, enable "Offline" mode (or turn off your Wi-Fi :) )
    image.png (503×1 px, 40 KB)
  5. Try opening the editor again – it will fail
  6. In your browser's developer tools, disable "Offline" mode (or turn on your Wi-Fi)
  7. Click "OK" to retry – editor should load

Note: it is necessary to open and close the editor first (step 2-3), because otherwise the loading will fail in a different way, as the editor code won't be loaded. That's probably also a bug…

Also, if I click "Cancel" in this popup, I end up in a broken mode where the editing toolbar is visible, but the read-mode uneditable content is showing.

image.png (980×1 px, 239 KB)

JTannerWMF removed a project: Editing QA.
JTannerWMF added subscribers: ppelberg, JTannerWMF.

@ppelberg to check to see if this is still and issue based on the steps in Bartosz's comment

@ppelberg to check to see if this is still and issue based on the steps in Bartosz's comment

This is working for me. VE loads after clicking the "Try again" button in the dialog [i] that surfaces after completing Step 5 described in T238332#5700721.


i.

Screen Shot 2020-10-21 at 6.48.20 PM.png (408×646 px, 92 KB)