Page MenuHomePhabricator

Visual diff does not load: TypeError: Cannot read properties of undefined (reading 'forEach')
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

What happens?:
Visual diff does not load.

On JavaScript console:

load.php?lang=en&modules=ext.discussionTools.init%7Cjquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=vector-2022&version=3p0no:337 jQuery.Deferred exception: Cannot read properties of undefined (reading 'forEach') TypeError: Cannot read properties of undefined (reading 'forEach')
    at Object.ve.dm.AlienNode.static.isDiffComparable (https://meta.wikimedia.org/w/load.php?lang=en&modules=ext.visualEditor.core%2Cmwtransclusion&skin=vector-2022&version=16wtj:313:196)
    at VeDmAlienBlockNode.ve.dm.Model.isDiffComparable (https://meta.wikimedia.org/w/load.php?lang=en&modules=ext.visualEditor.core%2Cmwtransclusion&skin=vector-2022&version=16wtj:29:756)
    at VeDmVisualDiff.ve.dm.VisualDiff.diffNodes (<anonymous>:734:201)
    at VeDmVisualDiff.ve.dm.VisualDiff.findModifiedNodes (<anonymous>:733:723)
    at VeDmVisualDiff.ve.dm.VisualDiff.diffList (<anonymous>:731:171)
    at VeDmVisualDiff.ve.dm.VisualDiff.diffDocs (<anonymous>:730:187)
    at new VeDmVisualDiff (<anonymous>:728:796)
    at <anonymous>:634:996
    at uri.query.diffmode (<anonymous>:549:193)
    at mightThrow (https://meta.wikimedia.org/w/load.php?lang=en&modules=ext.discussionTools.init%7Cjquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=vector-2022&version=3p0no:334:881) undefined

In debug mode:

load.php?debug=1&lang=en&modules=ext.RevisionSlider.Settings%2ClazyJs%7Cext.centralNotice.geoIP%7Cext.centralauth.ForeignApi%7Cext.centralauth.centralautologin.clearcookie%7Cext.discussionTools.init%7Cext.echo.api%2Cinit%7Cext.eventLogging%2CnavigationTiming%2Cthanks%2CwikimediaEvents%7Cext.thanks.corethank%7Cext.translate.edit.documentation%7Cext.translate.pagetranslation.uls%7Cext.uls.common%2Ccompactlinks%2Ci18n%2Cinterface%2Clanguagenames%2Cmediawiki%2Cmessages%2Cpreferences%2Cwebfonts%7Cjquery%2Cmoment%2Coojs%2Coojs-router%2Coojs-ui%2Coojs-ui-core%2Coojs-ui-toolbars%2Coojs-ui-widgets%2Coojs-ui-windows%2Crangefix%2Csite%7Cjquery.client%2Cconfirmable%2Ccookie%2Ci18n%2CtextSelection%2Culs%7Cjquery.uls.data%2Cgrid%7Cmediawiki.ForeignApi%2CString%2CTitle%2CUri%2Capi%2Cbase%2Ccldr%2Ccookie%2Cdiff%2Cexperiments%2CjqueryMsg%2Clanguage%2Cstorage%2Cuser%2Cutil%2CvisibleTimeout%7Cmediawiki.ForeignApi.core%7Cmediawiki.editfont.styles%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.ready%7Cmediawiki.page.watch.ajax%7Cmmv.bootstrap%2Chead%7Cmmv.bootstrap.autostart%7Coojs-ui-toolbars.icons%7Coojs-ui-widgets.icons%7Coojs-ui-windows.icons%7Coojs-ui.styles.icons-interactions%2Cicons-movement%7Cskins.vector.es6%2Cjs%7Cskins.vector.icons.js&skin=vector-2022&version=ztntf:16757 jQuery.Deferred exception: Cannot read properties of undefined (reading 'forEach') TypeError: Cannot read properties of undefined (reading 'forEach')
    at Object.ve.dm.AlienNode.static.isDiffComparable (https://meta.wikimedia.org/w/extensions/VisualEditor/lib/ve/src/dm/nodes/ve.dm.AlienNode.js?bdd27:94:27)
    at VeDmAlienBlockNode.ve.dm.Model.isDiffComparable (https://meta.wikimedia.org/w/extensions/VisualEditor/lib/ve/src/dm/ve.dm.Model.js?3bea7:504:33)
    at VeDmVisualDiff.ve.dm.VisualDiff.diffNodes (https://meta.wikimedia.org/w/extensions/VisualEditor/lib/ve/src/dm/ve.dm.VisualDiff.js?388b2:458:18)
    at VeDmVisualDiff.ve.dm.VisualDiff.findModifiedNodes (https://meta.wikimedia.org/w/extensions/VisualEditor/lib/ve/src/dm/ve.dm.VisualDiff.js?388b2:413:28)
    at VeDmVisualDiff.ve.dm.VisualDiff.diffList (https://meta.wikimedia.org/w/extensions/VisualEditor/lib/ve/src/dm/ve.dm.VisualDiff.js?388b2:220:9)
    at VeDmVisualDiff.ve.dm.VisualDiff.diffDocs (https://meta.wikimedia.org/w/extensions/VisualEditor/lib/ve/src/dm/ve.dm.VisualDiff.js?388b2:140:18)
    at new VeDmVisualDiff (https://meta.wikimedia.org/w/extensions/VisualEditor/lib/ve/src/dm/ve.dm.VisualDiff.js?388b2:68:17)
    at https://meta.wikimedia.org/w/extensions/VisualEditor/modules/ve-mw/preinit/ve.init.mw.DiffLoader.js?e5a7c:106:13
    at uri.query.diffmode (https://meta.wikimedia.org/w/extensions/VisualEditor/modules/ve-mw/preinit/ve.init.mw.DiffPage.init.js?a4e37:72:46)
    at mightThrow (https://meta.wikimedia.org/w/resources/lib/jquery/jquery.js?28492:3766:29) undefined

What should have happened instead?:
Visual diff should load

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:

Event Timeline

Interesting, I think this could maybe be something to do with the recent translate annotations changes, insofar as this is the element that it's erroring on:

image.png (402×1 px, 100 KB)

(@ihurbain? I might be over-indexing on having seen a translate tag.)

It'd be easy to not-error here, insofar as we could just add || [] to this following line:

var otherOriginalDomElements = ve.copy( otherStore.value( other.originalDomElementsHash ) );
otherOriginalDomElements.forEach( removeAboutAttributes );

...but I'm not sure whether that'd just be papering over some deeper error.

This is the diff:

image.png (508×2 px, 117 KB)

Change 790009 had a related patch set uploaded (by DLynch; author: DLynch):

[VisualEditor/VisualEditor@master] AlienNode diffs: give a fallback if there are no other elements present

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

@DLynch you're probably not over-indexing because we definitely touched things around aliennodes with the annotations/translate, so that may indeed well be related indeed.

Change 790009 merged by jenkins-bot:

[VisualEditor/VisualEditor@master] AlienNode diff: Ensure types match before doing a complex comparison

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

Change 790412 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (5c075c883)

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

Change 790412 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (5c075c883)

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

Visual DIff loads fine as expected:

Screenshot 2022-05-09 at 23.51.36.png (1×3 px, 269 KB)

Console is clear as well:
Screenshot 2022-05-09 at 23.52.34.png (1×3 px, 246 KB)

Before fix:

Screenshot 2022-05-09 at 23.52.57.png (1×3 px, 597 KB)

This comment was removed by EAkinloose.
ppelberg claimed this task.