Page MenuHomePhabricator

Some tables cannot be sorted (TypeError: $nextRows[i] is undefined in table sorting / Uncaught TypeError: Cannot read property 'type' of undefined / TypeError: cachedParsers[sortList[i][0]] is undefined
Closed, ResolvedPublic3 Estimated Story Points

Description

Click one of the columns in https://de.wikipedia.org/wiki/Liste_der_Torsch%C3%BCtzen_der_deutschen_Fu%C3%9Fballnationalmannschaft to get this production error

Also occurs in Votación en el exterior section in https://es.wikipedia.org/wiki/Elecciones_generales_de_Bolivia_de_2020 and https://tr.wikipedia.org/wiki/Menajerimi_Ara

In Chrome this error can appear as Uncaught TypeError: Cannot read property 'type' of undefined

at explodeRowspans URL1:583:460
at setupForFirstSort URL1:587:269
at construct/</< URL1:587:600
at dispatch URL1:208:742
at add/elemData.handle URL1:205:388

URL1: https://de.wikipedia.org/w/load.php?lang=de&modules=ext.centralNotice.choiceData%2Cdisplay%2CgeoIP%2CimpressionDiet%2CkvStore%2ClegacySupport%2CstartUp%7Cext.centralauth.centralautologin%7Cext.cite.ux-enhancements%7Cext.cx.eventlogging.campaigns%7Cext.eventLogging%2CnavigationTiming%2Cpopups%2CwikimediaEvents%7Cext.flaggedRevs.advanced%7Cext.quicksurveys.init%2Clib%7Cext.uls.common%2Ccompactlinks%2Cinit%2Cinterface%2Cpreferences%2Cwebfonts%7Cjquery%2Coojs%2Coojs-router%2Coojs-ui-core%2Coojs-ui-widgets%2Csite%7Cjquery.client%2Ccookie%2Ctablesorter%2CtextSelection%7Cjquery.uls.data%7Cmediawiki.String%2CTitle%2CUri%2Capi%2Cbase%2Ccldr%2Ccookie%2Cexperiments%2CjqueryMsg%2Clanguage%2Cstorage%2Cuser%2Cutil%2Cviewport%7Cmediawiki.editfont.styles%7Cmediawiki.language.months%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.ready%7Cmediawiki.ui.button%2Cicon%7Cmmv.bootstrap%2Chead%7Cmmv.bootstrap.autostart%7Coojs-ui-widgets.icons%7Cskins.vector.legacy.js%7Cuser.defaults&skin=vector&version=psnkp

When clicked a second time it throws a different error:

Stack trace:

at multisort URL1:579:825
at construct/</< URL1:588:543
at dispatch URL1:208:742
at add/elemData.handle URL1:205:388

URL1: https://fr.wikipedia.org/w/load.php?lang=fr&modules=ext.centralNotice.choiceData%2Cdisplay%2CgeoIP%2CkvStore%2CstartUp%7Cext.centralauth.centralautologin%7Cext.cite.ux-enhancements%7Cext.cx.eventlogging.campaigns%7Cext.eventLogging%2CnavigationTiming%2Cpopups%2CwikimediaEvents%7Cext.growthExperiments.SuggestedEditSession%7Cext.quicksurveys.init%2Clib%7Cext.uls.common%2Ccompactlinks%2Cinit%2Cinterface%2Cpreferences%2Cwebfonts%7Cjquery%2Coojs%2Coojs-router%2Coojs-ui-core%2Coojs-ui-widgets%2Csite%7Cjquery.client%2Ccookie%2Ctablesorter%2CtextSelection%7Cjquery.uls.data%7Cmediawiki.String%2CTitle%2CUri%2Capi%2Cbase%2Ccldr%2Ccookie%2Cexperiments%2CjqueryMsg%2Clanguage%2Cstorage%2Ctoc%2Cuser%2Cutil%2Cviewport%7Cmediawiki.editfont.styles%7Cmediawiki.language.months%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.ready%7Cmediawiki.ui.button%7Cmmv.bootstrap%2Chead%7Cmmv.bootstrap.autostart%7Coojs-ui-core.icons%2Cstyles%7Coojs-ui-widgets.icons%7Coojs-ui.styles.indicators%7Cskins.vector.js%7Cuser.defaults&skin=vector&version=1d43p

https://gerrit.wikimedia.org/g/mediawiki/core/+/bbc83e292b6cde67c3a906b9878badd3426cbd2f/resources/src/jquery.tablesorter/jquery.tablesorter.js#517

Qa steps

In production

Same as above but use

QA Results - Beta

ACStatusDetails
1T265503#6914700
2T265503#6914700

QA Results - Prod

ACStatusDetails
1T265503#6934500
2T265503#6934500

Event Timeline

This does not relate to T265134

There's an obvious fix

for ( i = 0; i < $nextRows.length - 1; i++ ) {
instead of
`for ( i = 0; i < rowSpan- 1; i++ ) {

however presumably there is an issue in the calculation of rowSpan that needs fixing.

Jdlrobson renamed this task from TypeError: $nextRows[i] is undefined in table sorting to Some tables cannot be sorted (TypeError: $nextRows[i] is undefined in table sorting).Oct 26 2020, 6:38 PM
Jdlrobson assigned this task to ovasileva.
Jdlrobson triaged this task as Medium priority.
Jdlrobson moved this task from Incoming to Needs Prioritization on the Readers-Web-Backlog board.
Jdlrobson renamed this task from Some tables cannot be sorted (TypeError: $nextRows[i] is undefined in table sorting) to Some tables cannot be sorted (TypeError: $nextRows[i] is undefined in table sorting) / Uncaught TypeError: Cannot read property 'type' of undefined.Dec 7 2020, 8:36 PM
Jdlrobson raised the priority of this task from Medium to High.
Jdlrobson updated the task description. (Show Details)

The number of errors is actually quite high and this is a top ten error now and user facing.

Jdlrobson renamed this task from Some tables cannot be sorted (TypeError: $nextRows[i] is undefined in table sorting) / Uncaught TypeError: Cannot read property 'type' of undefined to Some tables cannot be sorted (TypeError: $nextRows[i] is undefined in table sorting / Uncaught TypeError: Cannot read property 'type' of undefined / TypeError: cachedParsers[sortList[i][0]] is undefined.Feb 10 2021, 10:52 PM

Change 667035 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/core@master] Table sorting should work even if table is badly formatted

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

The error is due to badly formatted tables in the article. The fix is relatively straightforward. ^^^

Change 667035 merged by jenkins-bot:
[mediawiki/core@master] Table sorting should work even if table is badly formatted

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

Edtadros added a subscriber: Edtadros.

@Jdlrobson not sure how to validate this.

Jdlrobson updated the task description. (Show Details)

added qa steps

Change 670920 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] jquery.tablesorter: Follow-up 0c01cbf93

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

Change 670920 merged by jenkins-bot:
[mediawiki/core@master] jquery.tablesorter: Follow-up 0c01cbf93

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

Test Result - Beta

Status: ✅ PASS
Environment: beta
OS: macOS Big Sur
Browser: Chrome
Device: MBP
Emulated Device: NA

Test Artifact(s):

✅ AC1: Visit https://en.wikipedia.beta.wmflabs.org/wiki/T265503 and ensure the table can be sorted
✅ AC2: Make sure no JavaScript error occurs in the developer console.

Screen Recording 2021-03-15 at 9.34.06 AM.mov.gif (1×1 px, 1 MB)

Test Result - Prod

Status: ✅ PASS
Environment: eswiki, nlwiki, enwiki, jawiki
OS: macOS Big Sur
Browser: Chrome
Device: MBP
Emulated Device: NA

Test Artifact(s):

✅ AC1: Visit the links below and ensure the table can be sorted
✅ AC2: Make sure no JavaScript error occurs in the developer console.

https://es.wikipedia.org/wiki/Elecciones_generales_de_Bolivia_de_2020#Votaci%C3%B3n_en_el_exterior

Screen Recording 2021-03-22 at 5.46.05 AM.mov.gif (928×1 px, 1 MB)

https://nl.wikipedia.org/wiki/De_Jeugd_van_Tegenwoordig_(rapgroep) (sort the "Singles" table)
Screen Recording 2021-03-22 at 5.48.07 AM.mov.gif (928×1 px, 2 MB)

https://en.wikipedia.org/wiki/Philippa_Lowthorpe#Awards_and_nominations
Screen Recording 2021-03-22 at 5.49.24 AM.mov.gif (928×1 px, 2 MB)

https://ja.wikipedia.org/wiki/%E3%83%94%E3%82%BF%E3%82%B4%E3%83%A9%E3%82%B9%E3%82%A4%E3%83%83%E3%83%81#%E6%94%BE%E9%80%81%E6%99%82%E9%96%93 scroll down to the table with no rows.
Screen Recording 2021-03-22 at 5.50.16 AM.mov.gif (928×1 px, 536 KB)

https://en.wikipedia.org/wiki/California_State_Senate#Members
Screen Recording 2021-03-22 at 5.51.08 AM.mov.gif (928×1 px, 2 MB)

Good idea to log a warning to the console.