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-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org