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 parsing of bug related to d3fc splitting selection data (redux of #2039) #2043

Merged

Conversation

brochington
Copy link
Contributor

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

@finos finos deleted a comment from finos-cla-bot bot Dec 9, 2022
@timkpaine timkpaine requested a review from texodus December 9, 2022 23:44
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.

Looks good! Thanks for the PR!

@@ -32,7 +32,7 @@ function addDataValues(tooltipDiv, values) {
}

const formatNumber = (value) =>
value === null
value === null || value === 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 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).

Copy link
Contributor Author

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) {
Copy link
Member

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 :)

Copy link
Contributor Author

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", () => {
Copy link
Member

Choose a reason for hiding this comment

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

💯

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🙌🏻

@texodus texodus added the bug Concrete, reproducible bugs label Dec 10, 2022
@texodus texodus merged commit 66f2f84 into finos:master Dec 10, 2022
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