Skip to content

Commit

Permalink
fix rows len
Browse files Browse the repository at this point in the history
  • Loading branch information
ChanaChelem committed Aug 12, 2021
1 parent fef84a5 commit 136bd67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ class PartialCsvPreview extends Component<{}, PartialCsvState> {
classNames: [],
...DEFAULT_CELL_STATE
};
for (let i = 0; i < Math.min(table.cells.length, 150); i++) {
const tableLength = table.cells.length
for (let i = 0; i < Math.min(tableLength, 150); i++) {
const rowData = [];
let j = 0;
for (; j < table.cells[i].length + 1; j++) {
for (; j < table.cells[0].length + 1; j++) {
const cell: TableCell = {
content: table.cells[i][j],
content: i > tableLength ? '' : table.cells[i][j],
classNames: [],
...DEFAULT_CELL_STATE
};
Expand Down
4 changes: 2 additions & 2 deletions electron/src/renderer/project/table/combined-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class CombinedTable extends Component<{}, TableState> {
return;
}
const tableData = this.getClasslessTableData(table);
this.setState({ tableData, rowCount: Math.min(table.dims[0] + 1, 50) })
this.setState({ tableData, rowCount: Math.max(table.dims[0] + 1, 50) })
this.createAnnotationIfDoesNotExist();
}

Expand Down Expand Up @@ -1208,7 +1208,7 @@ class CombinedTable extends Component<{}, TableState> {
}

rowGetter(index: number): TableCell[] {
const { tableData, rowCount } = this.state;
const { tableData } = this.state;
if (!tableData) { return [] as TableCell[]; }
if (!wikiStore.table.loadedRows.has(index) && index < wikiStore.table.table.dims[0]) {
this.fetchRows(index);
Expand Down

0 comments on commit 136bd67

Please sign in to comment.