Skip to content

Commit

Permalink
fix: Error thrown when cell overflow position is unknown (#1177)
Browse files Browse the repository at this point in the history
Fixes #1116 

Couldn't reproduce the bug but changed the code to return
`NULL_POSITION` if any needed values are undefined instead of using
`assertNotNull`.
  • Loading branch information
emilyhuxng authored Mar 27, 2023
1 parent 1ce9547 commit bb24f61
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/iris-grid/src/IrisGridRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ class IrisGridRenderer extends GridRenderer {
height: number | null;
} {
const NULL_POSITION = { left: null, top: null, width: null, height: null };
if (mouseX == null || mouseY == null || !metrics) {
if (mouseX == null || mouseY == null || metrics == null) {
return NULL_POSITION;
}
const { rowHeight, columnWidth, left, top } = GridUtils.getCellInfoFromXY(
Expand All @@ -1014,9 +1014,10 @@ class IrisGridRenderer extends GridRenderer {
metrics
);

assertNotNull(left);
assertNotNull(columnWidth);
assertNotNull(top);
if (left == null || columnWidth == null || top == null) {
return NULL_POSITION;
}

const { width: gridWidth, verticalBarWidth } = metrics;
const { cellHorizontalPadding } = theme;

Expand Down

0 comments on commit bb24f61

Please sign in to comment.