Skip to content

Commit 6769ff3

Browse files
committed
detect model switch in progress
1 parent 0cab21d commit 6769ff3

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

packages/iris-grid/src/IrisGrid.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,6 +1382,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
13821382
getModelTotalsConfig = memoize(
13831383
(
13841384
columns: readonly DhType.Column[],
1385+
originalColumns: readonly DhType.Column[],
13851386
config: UIRollupConfig | undefined,
13861387
aggregationSettings: AggregationSettings
13871388
): UITotalsTableConfig | null => {
@@ -1390,6 +1391,18 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
13901391
return null;
13911392
}
13921393

1394+
// TODO: evaluate whether this should be moved to proxy model, since it should manage the model transition
1395+
// When a rollup is being removed the model `columns` still reflects the tree table's columns
1396+
// while the rollup config has already been cleared. Building a totals config with those stale
1397+
// column names would cause a server error.
1398+
if (
1399+
config != null &&
1400+
config.columns.length === 0 &&
1401+
columns !== originalColumns
1402+
) {
1403+
return null;
1404+
}
1405+
13931406
// Filter out aggregations without any columns actually selected
13941407
const aggregations = aggregationSettings.aggregations.filter(
13951408
agg => agg.selected.length > 0 || agg.invert
@@ -5235,6 +5248,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
52355248
)}
52365249
totalsConfig={this.getModelTotalsConfig(
52375250
model.columns,
5251+
model.originalColumns,
52385252
rollupConfig,
52395253
aggregationSettings
52405254
)}

0 commit comments

Comments
 (0)