-
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
Fix parsing of bug related to d3fc splitting selection data (redux of #2039) #2043
Fix parsing of bug related to d3fc splitting selection data (redux of #2039) #2043
Conversation
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.
Looks good! Thanks for the PR!
@@ -32,7 +32,7 @@ function addDataValues(tooltipDiv, values) { | |||
} | |||
|
|||
const formatNumber = (value) => | |||
value === null | |||
value === null || value === undefined |
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.
This is fine but just out of curiosity does this actually do anything? Perspective's APIs should not return undefined
, only null
for missing cells (in theory).
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.
I totally agree. I'm not a fan of undefined
either, and this was a "defensive" change. Currently there is somehow a case where type
can be undefined
, but should maybe be an enum variant, or optional string.
|
||
if (data.key) { | ||
splitValues = data.key.split("|"); | ||
} else if (data.mainValue?.split) { |
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.
I presume this ?
is the failing logic :)
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.
Yup, pretty much. The default case of [data.mainValue]
was never being reached.
@@ -143,4 +143,24 @@ describe("tooltip generateHTML should", () => { | |||
"main-1: 101", | |||
]); | |||
}); | |||
|
|||
test("Provide default number formatting for null and undefined types", () => { |
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 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.
🙌🏻
Currently there is a bug where selection data text splitting logic will throw an error if certain values of the data (key and mainValue properties) are not "splittable". This PR aims to correct the logic surrounding this splitting of values.
redo of a previous PR