Skip to content

Commit

Permalink
handle case when there are only too many rows
Browse files Browse the repository at this point in the history
  • Loading branch information
keckelt committed Mar 22, 2024
1 parent 54a988e commit 8fb22ce
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Detail/DataDiff.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ export function createSummaryVisualizationFromHTML(

let displayedRows: number = newTable[0].length - 1; // -1 line which is the header
let displayedColumns: number = Object.keys(newTable[0][0]).length - 1; //-1 which is the index

if (Object.keys(newTable[0][0]).includes('...')) {
displayedColumns--; // -1 for the ellipsis column
}
//HTML includes a p tag that summarizes the size of the data, e.g., "5 rows × 642 columns"
// extract rows and columns from html and referenceHTML
// summarize changes in p tag
Expand All @@ -213,7 +215,6 @@ export function createSummaryVisualizationFromHTML(
if (totalRows && totalColumns && (displayedRows !== totalRows || displayedColumns !== totalColumns)) {
// -1 if not all rows are shown because of the ellipsis (...) row between the first n and last n rows
displayedRows = totalRows === displayedRows ? displayedRows : displayedRows - 1;
displayedColumns = totalColumns === displayedColumns ? displayedColumns : displayedColumns - 1; // same for columns

const pTag = document.createElement('p');
pTag.style.fontSize = '0.66em';
Expand Down

0 comments on commit 8fb22ce

Please sign in to comment.