@@ -178,7 +178,7 @@ class IrisGridRenderer extends GridRenderer {
178178 state : IrisGridRenderState
179179 ) : void {
180180 const { metrics, model, theme } = state ;
181- const { groupedColumns, columns } = model ;
181+ const { groupedColumns } = model ;
182182 const { maxY, allColumnWidths, allColumnXs } = metrics ;
183183 if (
184184 groupedColumns . length === 0 ||
@@ -187,12 +187,16 @@ class IrisGridRenderer extends GridRenderer {
187187 return ;
188188 }
189189
190- const lastGroupedColumn = groupedColumns [ groupedColumns . length - 1 ] ;
191- const modelIndex = columns . findIndex (
192- c => c . name === lastGroupedColumn . name
193- ) ;
194- const columnX = allColumnXs . get ( modelIndex ) ;
195- const columnWidth = allColumnWidths . get ( modelIndex ) ;
190+ // This assumes that the engine puts the grouped columns at the start of the
191+ // model, so model and visible index match for grouped columns. If we ever
192+ // add freeze support for tree tables or allow moving the grouped columns,
193+ // this assumption may no longer hold true. If such a change occurs, we'll
194+ // need to revisit this since a single vertical divider may no longer make
195+ // sense.
196+ const lastVisibleGroupColumnIndex = groupedColumns . length - 1 ;
197+
198+ const columnX = allColumnXs . get ( lastVisibleGroupColumnIndex ) ;
199+ const columnWidth = allColumnWidths . get ( lastVisibleGroupColumnIndex ) ;
196200 if ( columnX == null || columnWidth == null ) {
197201 return ;
198202 }
0 commit comments