Page MenuHomePhabricator

TypeError: Cannot read properties of null (reading 'parentNode') at ThreadItem.js.ThreadItem.static.newFromJSON
Open, Needs TriagePublicPRODUCTION ERROR

Description

611 errors in last 7 days
Example: https://logstash.wikimedia.org/app/dashboards#/doc/logstash-*/logstash-default-1-7.0.0-1-2023.11.08?id=Hct5sIsBs8G7h3OwjBaq

	at ThreadItem.js.ThreadItem.static.newFromJSON  https://sv.wikipedia.org/w/load.php?lang=sv&modules=ext.discussionTools.init%7Cjquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=vector-2022&version=1t14t:122:191
at infuse  https://sv.wikipedia.org/w/load.php?lang=sv&modules=ext.discussionTools.init%7Cjquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=vector-2022&version=1t14t:119:504
at https://sv.wikipedia.org/w/load.php?lang=sv&modules=ext.discussionTools.init%7Cjquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=vector-2022&version=1t14t:119:623
at infuse  https://sv.wikipedia.org/w/load.php?lang=sv&modules=ext.discussionTools.init%7Cjquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=vector-2022&version=1t14t:119:592
at https://sv.wikipedia.org/w/load.php?lang=sv&modules=ext.discussionTools.init%7Cjquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=vector-2022&version=1t14t:119:623
at infuse  https://sv.wikipedia.org/w/load.php?lang=sv&modules=ext.discussionTools.init%7Cjquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=vector-2022&version=1t14t:119:592
at https://sv.wikipedia.org/w/load.php?lang=sv&modules=ext.discussionTools.init%7Cjquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=vector-2022&version=1t14t:119:623

Event Timeline

The error on the linked one is happening on a diff of a talk page. However, it doesn't happen to me when I visit that page.

The specific error just boils down to "a comment referenced in the serialized thread doesn't actually exist on the page". (It's in ThreadItem.js on line 111.) It's few enough errors for 7 days that it probably requires some specific user-configuration to happen -- a userscript that meddles with the content on diffs would be enough to do it.

mediawiki.base.js:504 Uncaught TypeError: Cannot read properties of null (reading 'parentNode')
    at ThreadItem.js.ThreadItem.static.newFromJSON (ThreadItem.js:113:31)
    at infuse (ThreadItemSet.js:32:34)
    at ThreadItemSet.js:36:57
    at Array.map (<anonymous>)
    at infuse (ThreadItemSet.js:36:35)
    at ThreadItemSet.js:43:3
    at Array.forEach (<anonymous>)
    at ThreadItemSet.js.ThreadItemSet.static.newFromJSON (ThreadItemSet.js:42:10)
    at Object.init (controller.js:324:37)
    at reallyInit (dt.init.js:38:14)

I see this in the console on different pages from time to time. With safemode=1 it doesn't seem to happen. I was afraid Convenient-Discussions does this, but no. There seems to be some race condition there, and I don't always catch this (at times, another bug happens instead of this one, namely T367639), so you may need to try it in different ways to see the bug:

Could this be related to T348680?

Should be fixed by https://www.mediawiki.org/w/index.php?title=MediaWiki%3AGadget-tabbedwindow.js&diff=6588257&oldid=6583748

DT expects to find the HTML it generated when it infuses the page, so lets preserve the original headings (hidden) instead.

This is still occurring at a significant rante - mostly on bn.m.wikivoyage.org and en.m.wikivoyage.org
so I assume a gadget there also needs to be updated.

It's something about the heading getting adjusted. The failure on that page is because document.getElementById('h-স্থান-20241004194000') isn't finding anything.

desktop
image.png (202×1 px, 66 KB)
mobile
image.png (136×1 px, 54 KB)

...so on mobile there, we've not got the data-mw-comment-start element for the headings.

One more case of this error that I could localize – this time because of RevisionSlider:

  1. Go to https://en.wikipedia.org/w/index.php?diff=1262221555&oldid=1262192427&title=Project:Village_pump_(proposals)&safemode=1&dtenable=1 (note &safemode=1 in the URL – it's not some user script interfering).
  2. Click "Browse history interactively".
  3. Press "Previous edit" (but not "Next edit" for some reason).

In general, I would appreciate making the code more forgiving, because at this point I'm kind of used to scripts, including mine, changing something in the DOM for what DiscussionTools wasn't ready.

Restricted Application changed the subtype of this task from "Bug Report" to "Production Error". · View Herald TranscriptWed, Dec 11, 12:28 AM