Skip to content

Commit

Permalink
fix: Proxy model appears partition even if original model is not (#2373)
Browse files Browse the repository at this point in the history
https://deephaven.atlassian.net/browse/DH-18545

`IrisGridProxyModel` is a `PartitionedGridModel` and always returns
`true` for `isPartitionedGridModelProvider` and
`isPartitionedGridModel`.

This fix changes the proxy return values so those methods return `false`
if they would return `false` for the original model.
  • Loading branch information
dgodinez-dh authored Feb 26, 2025
1 parent 35fc599 commit 8cc36a5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/iris-grid/src/IrisGridProxyModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
type PartitionConfig,
type PartitionedGridModel,
isPartitionedGridModelProvider,
isPartitionedGridModel,
} from './PartitionedGridModel';

const log = Log.module('IrisGridProxyModel');
Expand Down Expand Up @@ -300,6 +301,10 @@ class IrisGridProxyModel extends IrisGridModel implements PartitionedGridModel {
!isPartitionedGridModelProvider(this.originalModel) ||
!this.originalModel.isPartitionRequired
) {
if (!isPartitionedGridModel(this.originalModel)) {
// @ts-expect-error If the original model has an undefined partitionConfig return undefined to make the proxy model also return false in isPartitionedGridModel
return undefined;
}
return null;
}
return this.partition;
Expand Down Expand Up @@ -431,9 +436,10 @@ class IrisGridProxyModel extends IrisGridModel implements PartitionedGridModel {
}

get isPartitionRequired(): boolean {
// @ts-expect-error If the original model is not a partitioned model return undefined to make the proxy model also return false in isPartitionedGridModelProvider
return isPartitionedGridModelProvider(this.originalModel)
? this.originalModel.isPartitionRequired
: false;
: undefined;
}

get formatter(): Formatter {
Expand Down

0 comments on commit 8cc36a5

Please sign in to comment.