You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "cbum-dev (via GitHub)" <gi...@apache.org> on 2025/09/10 10:53:24 UTC
[PR] fix (pie chart) fixes pie chart other click error [superset]
cbum-dev opened a new pull request, #35086:
URL: https://github.com/apache/superset/pull/35086
<!---
Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
Example:
fix(dashboard): load charts correctly
-->
Fixes pie chart run time error on clicking the "other" group.
Related to #35028
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
The issue was caused by the event handler in eventHandlers.ts which did not account for the "Other" group not having a corresponding entry in the labelMap. This led to an attempt to access a property on an undefined value, resulting in a TypeError.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
Before:-
<img width="1248" height="760" alt="Screenshot 2025-09-10 at 16 20 58" src="https://github.com/user-attachments/assets/bc570c71-5865-4b80-9033-02d411f1a046" />
After:-
<img width="1248" height="760" alt="Screenshot 2025-09-10 at 16 21 27" src="https://github.com/user-attachments/assets/35d55804-46ee-4334-9e01-7417b709235a" />
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
Create or open a dashboard with a Pie Chart, ensure an "Other" slice is generated (e.g., by lowering the Series Limit), then click both a regular slice and the "Other" slice.
Verify that regular slices support cross-filtering as expected, while clicking "Other" does not crash the app and shows no drill-down options.
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [x] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(pie): fixes pie chart other click error [superset]
Posted by "msyavuz (via GitHub)" <gi...@apache.org>.
msyavuz merged PR #35086:
URL: https://github.com/apache/superset/pull/35086
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(pie): fixes pie chart other click error [superset]
Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on code in PR #35086:
URL: https://github.com/apache/superset/pull/35086#discussion_r2338358479
##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/eventHandlers.ts:
##########
@@ -54,7 +54,9 @@ const getCrossFilterDataMask =
values = [value];
}
- const groupbyValues = values.map(value => labelMap[value]);
+ const groupbyValues = values
+ .map(value => labelMap[value])
+ .filter(Boolean) as string[][];
Review Comment:
wait what does this .filter() do?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(pie): fixes pie chart other click error [superset]
Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on PR #35086:
URL: https://github.com/apache/superset/pull/35086#issuecomment-3277262410
Hoping @kgabryje can take a look. Looked a bit and was wondering if `Others` should have a value?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(pie): fixes pie chart other click error [superset]
Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on code in PR #35086:
URL: https://github.com/apache/superset/pull/35086#discussion_r2338358479
##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/eventHandlers.ts:
##########
@@ -54,7 +54,9 @@ const getCrossFilterDataMask =
values = [value];
}
- const groupbyValues = values.map(value => labelMap[value]);
+ const groupbyValues = values
+ .map(value => labelMap[value])
+ .filter(Boolean) as string[][];
Review Comment:
wait what does this .filter() do?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix (pie chart) fixes pie chart other click error [superset]
Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #35086:
URL: https://github.com/apache/superset/pull/35086#discussion_r2336369233
##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/eventHandlers.ts:
##########
@@ -54,7 +54,9 @@ const getCrossFilterDataMask =
values = [value];
}
- const groupbyValues = values.map(value => labelMap[value]);
+ const groupbyValues = values
+ .map(value => labelMap[value])
+ .filter(Boolean) as string[][];
Review Comment:
### Unsafe type assertion after filtering <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The type assertion 'as string[][]' after filter(Boolean) may lead to runtime errors if labelMap contains non-string values.
###### Why this matters
If labelMap contains values that are truthy but not string arrays (like numbers or objects), the type assertion will not prevent runtime errors when the values are used.
###### Suggested change ∙ *Feature Preview*
Replace with a more specific type guard to ensure array elements are string arrays:
```typescript
const groupbyValues = values
.map(value => labelMap[value])
.filter((value): value is string[] =>
Array.isArray(value) && value.every(item => typeof item === 'string')
);
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/eaa85304-ad88-487c-8718-94d5bae9b035/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/eaa85304-ad88-487c-8718-94d5bae9b035?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/eaa85304-ad88-487c-8718-94d5bae9b035?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/eaa85304-ad88-487c-8718-94d5bae9b035?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/eaa85304-ad88-487c-8718-94d5bae9b035)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:34be615f-d0f6-4ea7-bbab-0e303a9ac6e3 -->
[](34be615f-d0f6-4ea7-bbab-0e303a9ac6e3)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(pie): fixes pie chart other click error [superset]
Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #35086:
URL: https://github.com/apache/superset/pull/35086#discussion_r2338358782
##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/eventHandlers.ts:
##########
@@ -54,7 +54,9 @@ const getCrossFilterDataMask =
values = [value];
}
- const groupbyValues = values.map(value => labelMap[value]);
+ const groupbyValues = values
+ .map(value => labelMap[value])
+ .filter(Boolean) as string[][];
Review Comment:
filter(Boolean) removes any null/undefined values from the array. In this context, it prevents errors when labelMap doesn't contain an entry for the "Other" group by filtering out that undefined result before further processing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org