Page MenuHomePhabricator

"Cannot read properties of null (reading 'keyedNodes')" opening Basic citation in 2017 Source Editor
Closed, ResolvedPublicBUG REPORT

Description

What is the problem?

Trying to add a reference on beta in the 2017 Source Editor, it fails and I see the JavaScript exception:

Chrome:

Uncaught TypeError: Cannot read properties of null (reading 'keyedNodes')
    at ve.dm.MWGroupReferences.getRefUsages (ve.dm.MWGroupReferences.js:198:26)
    at ve.ui.MWReferenceEditPanel.updateReuseWarningFromRef (ve.ui.MWReferenceEditPanel.js:251:4)
    at ve.ui.MWReferenceEditPanel.setReferenceForEditing (ve.ui.MWReferenceEditPanel.js:214:7)
    at eval (ve.ui.MWReferenceDialog.js:223:19)
    at eval (oojs-ui-windows.js:756:33)
    at mightThrow (jquery.js:3489:29)
    at process (jquery.js:3557:12)

Firefox:

Uncaught TypeError: this.nodeGroup is null
    getRefUsages https://ar.wikipedia.beta.wmflabs.org/w/load.php?lang=en&modules=ext.cite.visualEditor.core&skin=vector-2022&version=s6bai:5
    updateReuseWarningFromRef https://ar.wikipedia.beta.wmflabs.org/w/load.php?lang=en&modules=ext.cite.visualEditor&skin=vector-2022&version=1fxgb:33
    setReferenceForEditing https://ar.wikipedia.beta.wmflabs.org/w/load.php?lang=en&modules=ext.cite.visualEditor&skin=vector-2022&version=1fxgb:32
    getSetupProcess https://ar.wikipedia.beta.wmflabs.org/w/load.php?lang=en&modules=ext.cite.visualEditor&skin=vector-2022&version=1fxgb:24
    proceed https://ar.wikipedia.beta.wmflabs.org/w/load.php?lang=en&modules=oojs-ui-windows&skin=vector-2022&version=53oow:6
    jQuery 51
load.php:5:716

This only seems to happen in the case where Cite is a dropdown with two options, not when Cite is a single button.

I have checked that the Basic cite does work in the visual VisualEditor.

Steps to reproduce problem
  1. Login to https://cs.wikipedia.beta.wmflabs.org
  2. Enable the 2017 Source Editor:
    1. https://cs.wikipedia.beta.wmflabs.org/wiki/Speciální:Nastavení?uselang=en#mw-prefsection-editing
    2. Check Use the wikitext mode inside the visual editor... and submit
  3. https://cs.wikipedia.beta.wmflabs.org/w/index.php?title=Wikimedia_Česká_republika&veaction=editsource
  4. Open the developer toolbar so you see the JS error
  5. Open the Citace (Cite) dropdown and click Základní (Basic)

Expected behaviour: Cite popup appears.
Observed behaviour: JavaScript error.

Environment

Browser: Firefox 115, Chromium 120.
Wiki(s): MediaWiki 1.43.0-alpha (d23abdc) 09:01, 30 August 2024.

Editor: VisualEditor – (dedd30b) 09:20, 30 August 2024.

Screenshots

ve_cite_basic.png (338×982 px, 54 KB)

Event Timeline

dom_walden renamed this task from "Cannot read properties of null (reading 'keyedNodes')" opening Basic citation to "Cannot read properties of null (reading 'keyedNodes')" opening Basic citation in 2017 Source Editor.Aug 30 2024, 8:29 AM
dom_walden updated the task description. (Show Details)

Change #1069236 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Cite@master] Fix null reference error in 2017 source editor

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

Change #1069236 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Fix null reference error in 2017 source editor

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

Change #1070232 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/extensions/Cite@master] Finish safety fallback for missing groups

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

One small breadcrumb about this weird bug: the difference between the 2017 (VE) source editor and visual editing seems to be that it doesn't add a placeholder reference node to the empty document fragment before opening the dialog, so no default reference group gets implicitly created.

Change #1070232 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Finish safety fallback for missing groups

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

https://gerrit.wikimedia.org/r/1070232 is essentially just ongoing code cleanup. We are not aware of a way a user could trigger an error in the spots touched by https://gerrit.wikimedia.org/r/1070232. Therefor we don't think this needs backporting.

Thanks @thiemowmde. So this issue is no longer a train blocker?

To my knowledge, no, this is not a blocker any more. https://gerrit.wikimedia.org/r/1069236 fixed it before the branch cut.

WMDE-Fisch removed thiemowmde as the assignee of this task.