Skip to content

Commit

Permalink
Fix null partition filter
Browse files Browse the repository at this point in the history
  • Loading branch information
vbabich committed Apr 22, 2024
1 parent 01c2a06 commit b8f31c9
Showing 1 changed file with 12 additions and 28 deletions.
40 changes: 12 additions & 28 deletions packages/iris-grid/src/IrisGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2043,39 +2043,23 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
model.partitionKeysTable(),
resolved => resolved.close()
);
const { dh } = model;

const sorts = keyTable.columns.map(column => column.sort().desc());
keyTable.applySort(sorts);
keyTable.setViewport(0, 0);

return new Promise((resolve, reject) => {
// We want to wait for the first UPDATED event instead of just getting viewport data here
// It's possible that the key table does not have any rows of data yet, so just wait until it does have one
keyTable.addEventListener(
dh.Table.EVENT_UPDATED,
(event: CustomEvent<DhType.ViewportData>) => {
try {
const { detail: data } = event;
if (data.rows.length === 0) {
// Table is empty, wait for the next updated event
return;
}
const row = data.rows[0];
const values = keyTable.columns.map(column => row.get(column));
const newPartition: PartitionConfig = {
partitions: values,
mode: 'partition',
};
keyTable.close();
resolve(newPartition);
} catch (e) {
keyTable.close();
reject(e);
}
}
);
});
const { rows } = await keyTable.getViewportData();
let values = [];
if (rows.length > 0) {
const row = rows[0];
values = keyTable.columns.map(column => row.get(column));
}
const newPartition: PartitionConfig = {
partitions: values,
mode: 'partition',
};
keyTable.close();
return newPartition;
}

copyCell(
Expand Down

0 comments on commit b8f31c9

Please sign in to comment.