Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: column preview types not accurate #1702

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions packages/iris-grid/src/ColumnStatistics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,14 @@ class ColumnStatistics extends Component<
statistics == null &&
model.isColumnStatisticsAvailable;
const statisticElements = [];
const columnType = column.type.substring(column.type.lastIndexOf('.') + 1);
const description = column.description === null ? null : column.description;
let columnType = column.type.substring(column.type.lastIndexOf('.') + 1);
let description;
if (column.description != null && column.description !== undefined) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is redundant. != null will mean that !== undefined is always true. You'd only need to strictly check against undefined if you strictly checked against null, e.g. !== null instead of just != null.
When checking against both null and undefined, doing a loose check != null is fine.

description = column.type.substring(column.type.lastIndexOf('.') + 1);
columnType = column.description.substring(
column.description.lastIndexOf('.') + 1
);
}
if (statistics != null) {
for (let i = 0; i < statistics.length; i += 1) {
const { operation, className, value, type } = statistics[i];
Expand Down Expand Up @@ -209,7 +215,9 @@ class ColumnStatistics extends Component<
/>
</div>
{description != null && (
<div className="column-statistics-description">{description}</div>
<div className="column-statistics-description">
Previewing as {description}
</div>
)}
{columnIndex != null && !model.isColumnSortable(columnIndex) && (
<div className="column-statistics-status">
Expand Down
Loading