Page MenuHomePhabricator

"TypeError: dataMatrixLine is undefined" when trying to add a column to a table with an empty <tr> at the end
Closed, ResolvedPublic1 Estimated Story Points

Description

When trying to add a column to the big table on https://www.wikidata.org/w/index.php?title=User:Glorian_Yapinus_(WMDE)/quantity_change_properties&oldid=414054606, I get:

TypeError: dataMatrixLine is undefined
ve.ui.TableAction.prototype.insertRowOrCol()        load.php:875
ve.ui.TableAction.prototype.insert()                load.php:867
ve.ui.Surface.prototype.execute()                   load.php:789
ve.ui.Command.prototype.execute()                   load.php:815
ve.ui.TableLineContextItem.prototype.onActionButtonClick()

I tried action=edit with debug=1, but then I don't even get any toolbar buttons.

This is with FF 49.0 on Ubuntu.

Event Timeline

Jdforrester-WMF set the point value for this task to 1.
Jdforrester-WMF moved this task from To Triage to TR0: Interrupt on the VisualEditor board.
Jdforrester-WMF added a subscriber: Jdforrester-WMF.

I'm getting:

Uncaught TypeError: Cannot read property 'cells' of undefined
    at VeUiTableAction.ve.ui.TableAction.insertRowOrCol
    at VeUiTableAction.ve.ui.TableAction.insert
    at VeUiDesktopSurface.ve.ui.Surface.execute

… which is equally not good.

The table seems to be incomplete / parsed into VE as incomplete, or so I'm guessing from this rendering:

pasted_file (164×837 px, 42 KB)

(Note the partial row at the bottom.)

The error is because the code assumes that if it reaches a not-present cell index, dataMatrixLine.cells must be present with a new cell to insert there.

Specifically, the Parsoid output for this page includes an empty table row at the end: https://www.wikidata.org/api/rest_v1/page/html/User%3AGlorian_Yapinus_(WMDE)%2Fquantity_change_properties/414054606?redirect=false

Which is fair enough, because the wikitext markup for it includes an empty row at the end:

{| class="wikitable"
|'''Properties'''
|'''Exact Value'''
|'''Measurement'''
|'''I Don’t Know/Am Not Sure'''
|----
|generation time (P3337)
|
|X
|
|----
|operating income (P3362)
|
|X
|
|----
|}
Jdforrester-WMF renamed this task from "TypeError: dataMatrixLine is undefined" when trying to add table coloumn using VE to "TypeError: dataMatrixLine is undefined" when trying to add a column to a table with an empty <tr> at the end.Dec 6 2016, 10:16 PM

Change 326162 had a related patch set uploaded (by DLynch):
ui.TableAction: don't try to add cells if none have been provided

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

Change 326162 merged by jenkins-bot:
ui.TableAction: don't try to add cells if none have been provided

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

Change 326141 had a related patch set uploaded (by Jforrester):
Update VE core submodule to master (33012af)

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

Jdforrester-WMF claimed this task.
Jdforrester-WMF reassigned this task from Jdforrester-WMF to DLynch.
Jdforrester-WMF removed a project: Patch-For-Review.

Change 326141 merged by jenkins-bot:
Update VE core submodule to master (33012af)

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