-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
…agging to new column selector Signed-off-by: Tarek Quao <[email protected]>
Signed-off-by: Tarek Quao <[email protected]>
There was a problem hiding this 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"); |
There was a problem hiding this comment.
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} /> |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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} /> |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
☠️
Column type icon matches the datatype type of the field in column selectors (where, group by, sortby, filter)
This PR fixes the issue of icons of columns defaulting to string icon instead of the right data type in issue #2580