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

Column type icon matches the datatype type of the field in column selectors (where, group by, sortby, filter) #2780

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

tarekquao
Copy link
Contributor

This PR fixes the issue of icons of columns defaulting to string icon instead of the right data type in issue #2580

@tarekquao tarekquao marked this pull request as draft October 8, 2024 10:20
@tarekquao tarekquao marked this pull request as ready for review October 8, 2024 10:21
@texodus texodus added the bug Concrete, reproducible bugs label Oct 17, 2024
Copy link
Member

@texodus texodus left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! A few notes to keep in mind for future PRs:

  • We normally ask for a unit test with all PRs, but this is relatively minor so I'll let it slide. For the record though, testing this should be quite easy - just set up a viewer with a config and check the DOM output (many of our perspective-viewer tests do this already e.g.).
  • Watch for ☠️ dead code ☠️ please, there's no point in leaving commented-out code when we have the project history on GitHub.
  • Generally prefer not to use .expect() in Perspective WASM code, as it leads to bad errors when an expectation is missed (sometimes generations after your PR is merged).

@@ -456,6 +456,8 @@ impl Component for FilterColumn {
}
.unwrap_or_default();

let final_col_type = col_type.expect("Unknown column");
Copy link
Member

Choose a reason for hiding this comment

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

There is no point in using expect() in Perspective WASM code because the error message does not propagate to the JS console. Generally we want to safely handle when this is missing because panic! leads to a frozen/broken web app that has to be refreshed.

@@ -465,7 +467,8 @@ impl Component for FilterColumn {
>
<LocalStyle href={css!("filter-item")} />
<div class="pivot-column-border">
<TypeIcon ty={ColumnType::String} />
// <TypeIcon ty={ColumnType::String} />
Copy link
Member

Choose a reason for hiding this comment

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

☠️

@@ -10,18 +10,20 @@
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

use perspective_client::ColumnType;
// use perspective_client::ColumnType;
Copy link
Member

Choose a reason for hiding this comment

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

☠️

@@ -69,7 +78,8 @@ impl Component for PivotColumn {
ondragend={dragend}
>
<div class="pivot-column-border">
<TypeIcon ty={ColumnType::String} />
<TypeIcon ty={col_type} />
// <TypeIcon ty={ColumnType::String} />
Copy link
Member

Choose a reason for hiding this comment

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

☠️

@@ -11,7 +11,7 @@
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

use perspective_client::config::*;
use perspective_client::ColumnType;
// use perspective_client::ColumnType;
Copy link
Member

Choose a reason for hiding this comment

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

☠️

@texodus texodus merged commit cf12bce into finos:master Oct 17, 2024
11 checks passed
onesimus-wiafe pushed a commit to onesimus-wiafe/perspective that referenced this pull request Oct 18, 2024
Column type icon matches the datatype type of the field in column selectors (where, group by, sortby, filter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Concrete, reproducible bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants