korbit-ai[bot] commented on code in PR #32863: URL: https://github.com/apache/superset/pull/32863#discussion_r2014459401
########## superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx: ########## @@ -486,8 +486,9 @@ const config: ControlPanelConfig = { return true; }, mapStateToProps(explore, _, chart) { + const timeComparevalue = explore?.controls?.time_compare?.value; const timeComparisonStatus = - !!explore?.controls?.time_compare?.value; + Array.isArray(timeComparevalue) ? timeComparevalue.length > 0 : !!timeComparevalue; Review Comment: ### Over-permissive truthy value check <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? The fallback for non-array values using double negation could interpret non-empty strings or numbers as valid time comparisons ###### Why this matters Using !! operator will convert any truthy value (like strings or numbers) to true, which could incorrectly indicate that time comparison is enabled when it shouldn't be. ###### Suggested change ∙ *Feature Preview* Restrict the accepted values to only valid time comparison inputs: ```typescript const timeComparisonStatus = Array.isArray(timeComparevalue) ? timeComparevalue.length > 0 : false; ``` ###### Provide feedback to improve future suggestions [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a1b8a760-de12-4c79-b359-861ace2d002d/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a1b8a760-de12-4c79-b359-861ace2d002d?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a1b8a760-de12-4c79-b359-861ace2d002d?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a1b8a760-de12-4c79-b359-861ace2d002d?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/a1b8a760-de12-4c79-b359-861ace2d002d) </details> <sub> 💬 Looking for more details? Reply to this comment to chat with Korbit. </sub> <!--- korbi internal id:f67aec17-8672-4f15-a7c1-e8406b065715 --> [](f67aec17-8672-4f15-a7c1-e8406b065715) -- 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