From e4bed0fbb22f43e4ddd77c40031d52fa8c262abc Mon Sep 17 00:00:00 2001 From: Akshat Jawne Date: Mon, 15 Jul 2024 12:08:56 -0600 Subject: [PATCH 1/3] WIP diagnosing problem --- packages/iris-grid/src/IrisGrid.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/iris-grid/src/IrisGrid.tsx b/packages/iris-grid/src/IrisGrid.tsx index e43b7a9220..a84dd6a674 100644 --- a/packages/iris-grid/src/IrisGrid.tsx +++ b/packages/iris-grid/src/IrisGrid.tsx @@ -1487,6 +1487,9 @@ class IrisGrid extends Component { return columnIndex != null ? modelColumns.get(columnIndex) : null; } + // the error is switching between row and column being defined + // this is because the metrics does not include the value? + getModelRow(rowIndex: GridRangeIndex): ModelIndex | null | undefined { const { metrics } = this.state; assertNotNull(metrics); From be973cacd6da046eed12ecfc435bdda657aa4c34 Mon Sep 17 00:00:00 2001 From: Akshat Jawne Date: Tue, 16 Jul 2024 10:32:49 -0600 Subject: [PATCH 2/3] fix: error when edited cell is out of grid viewport --- packages/grid/src/Grid.tsx | 16 +++++++++++++--- packages/iris-grid/src/IrisGrid.tsx | 3 --- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/grid/src/Grid.tsx b/packages/grid/src/Grid.tsx index 7a44863bc2..7e95bbda26 100644 --- a/packages/grid/src/Grid.tsx +++ b/packages/grid/src/Grid.tsx @@ -2167,15 +2167,25 @@ class Grid extends PureComponent { } : { opacity: 0 }; - const modelColumn = this.getModelColumn(column); - const modelRow = this.getModelRow(row); + let modelColumn; + let modelRow; + try { + modelColumn = this.getModelColumn(column); + modelRow = this.getModelRow(row); + } catch (e) { + // eslint-disable-next-line no-console + return null; + } const inputStyle: CSSProperties | undefined = modelColumn != null && modelRow != null ? { textAlign: model.textAlignForCell(modelColumn, modelRow), } : undefined; - const isValid = model.isValidForCell(modelColumn, modelRow, value); + const isValid = + modelColumn != null && modelRow != null + ? model.isValidForCell(modelColumn, modelRow, value) + : false; return (
diff --git a/packages/iris-grid/src/IrisGrid.tsx b/packages/iris-grid/src/IrisGrid.tsx index a84dd6a674..e43b7a9220 100644 --- a/packages/iris-grid/src/IrisGrid.tsx +++ b/packages/iris-grid/src/IrisGrid.tsx @@ -1487,9 +1487,6 @@ class IrisGrid extends Component { return columnIndex != null ? modelColumns.get(columnIndex) : null; } - // the error is switching between row and column being defined - // this is because the metrics does not include the value? - getModelRow(rowIndex: GridRangeIndex): ModelIndex | null | undefined { const { metrics } = this.state; assertNotNull(metrics); From 9fd7a755c635f55ec2d6c727fe794dfc80c0d896 Mon Sep 17 00:00:00 2001 From: Akshat Jawne Date: Wed, 17 Jul 2024 10:27:18 -0600 Subject: [PATCH 3/3] remove unneccessary eslint comment --- packages/grid/src/Grid.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/grid/src/Grid.tsx b/packages/grid/src/Grid.tsx index 7e95bbda26..dcbc809b5d 100644 --- a/packages/grid/src/Grid.tsx +++ b/packages/grid/src/Grid.tsx @@ -2173,7 +2173,6 @@ class Grid extends PureComponent { modelColumn = this.getModelColumn(column); modelRow = this.getModelRow(row); } catch (e) { - // eslint-disable-next-line no-console return null; } const inputStyle: CSSProperties | undefined =