Preview crashes with TypeError: undefined is not iterable in Layout.findOverflow
Previewer.preview()
is crashing with "TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))" when a table cannot fit in the page. I cannot pinpoint the exact cause, there are also nested tables in the document, but the problem goes away if wide enough paper (A3) is used. The error occurs in the innermost loop of Layout.findOverflow
, where previousRow.cells
is undefined
and Array.from
fails:
while (previousRow !== null) {
previousRowColumnCount = 0;
for (const cell of Array.from(previousRow.cells)) {
previousRowColumnCount += parseInt(cell.getAttribute("COLSPAN") || "1");
}
if (previousRowColumnCount === columnCount) {
break;
}
previousRow = previousRow.previousSibling;
}
Error stack:
TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
at Function.from (<anonymous>)
at Layout.findOverflow (<anonymous>:1774:35)
at Layout.findBreakToken (<anonymous>:1665:23)
at Layout.renderTo (<anonymous>:1425:26)
at Page.layout (<anonymous>:2119:46)
at Chunker.layout (<anonymous>:2874:28)
at async Chunker.renderAsync (<anonymous>:2795:16)
The offending HTML file: pagedjs_error_RISKS.html