(firstKey: Key, lastKey: Key, isSSR = false)
| 180 | } |
| 181 | |
| 182 | commit(firstKey: Key, lastKey: Key, isSSR = false) { |
| 183 | this.updateColumns(isSSR); |
| 184 | |
| 185 | this.firstKey = firstKey; |
| 186 | this.lastKey = lastKey; |
| 187 | this.rows = []; |
| 188 | for (let row of this.getRows()) { |
| 189 | let lastChildKey = (row as CollectionNode<T>).lastChildKey; |
| 190 | if (lastChildKey != null) { |
| 191 | let lastCell = this.getItem(lastChildKey) as GridNode<T> | null; |
| 192 | while (lastCell && lastCell.type !== 'cell') { |
| 193 | lastCell = |
| 194 | lastCell.prevKey != null |
| 195 | ? (this.getItem(lastCell.prevKey) as GridNode<T> | null) |
| 196 | : null; |
| 197 | } |
| 198 | if (lastCell) { |
| 199 | let numberOfCellsInRow = (lastCell.colIndex ?? lastCell.index) + (lastCell.colSpan ?? 1); |
| 200 | if (numberOfCellsInRow !== this.columns.length && !isSSR) { |
| 201 | throw new Error( |
| 202 | `Cell count must match column count. Found ${numberOfCellsInRow} cells and ${this.columns.length} columns.` |
| 203 | ); |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | this.rows.push(row); |
| 208 | } |
| 209 | |
| 210 | super.commit(firstKey, lastKey, isSSR); |
| 211 | } |
| 212 | |
| 213 | private updateColumns(isSSR: boolean) { |
| 214 | if (!this.columnsDirty) { |
nothing calls this directly
no test coverage detected