Skip to content

Commit bb24f61

Browse files
authored
fix: Error thrown when cell overflow position is unknown (#1177)
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`.
1 parent 1ce9547 commit bb24f61

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

packages/iris-grid/src/IrisGridRenderer.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ class IrisGridRenderer extends GridRenderer {
10051005
height: number | null;
10061006
} {
10071007
const NULL_POSITION = { left: null, top: null, width: null, height: null };
1008-
if (mouseX == null || mouseY == null || !metrics) {
1008+
if (mouseX == null || mouseY == null || metrics == null) {
10091009
return NULL_POSITION;
10101010
}
10111011
const { rowHeight, columnWidth, left, top } = GridUtils.getCellInfoFromXY(
@@ -1014,9 +1014,10 @@ class IrisGridRenderer extends GridRenderer {
10141014
metrics
10151015
);
10161016

1017-
assertNotNull(left);
1018-
assertNotNull(columnWidth);
1019-
assertNotNull(top);
1017+
if (left == null || columnWidth == null || top == null) {
1018+
return NULL_POSITION;
1019+
}
1020+
10201021
const { width: gridWidth, verticalBarWidth } = metrics;
10211022
const { cellHorizontalPadding } = theme;
10221023

0 commit comments

Comments
 (0)