bito-code-review[bot] commented on code in PR #37107:
URL: https://github.com/apache/superset/pull/37107#discussion_r2695367790
##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx:
##########
@@ -238,10 +238,10 @@ const FilterValue: FC<FilterValueProps> = ({
// deal with getChartDataRequest transforming the response data
const result = 'result' in json ? json.result[0] : json;
if (response.status === 200) {
- setState([result]);
+ setState([result as ChartDataResponseResult]);
handleFilterLoadFinish();
} else if (response.status === 202) {
- waitForAsyncData(result)
+ waitForAsyncData(result as ChartDataResponseResult)
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incorrect Type Assertion in Async Path</b></div>
<div id="fix">
The type assertion here is incorrect; for status 202 responses, result is an
AsyncEvent (with job_id, etc.), not a ChartDataResponseResult. This mismatch
could lead to runtime errors when waitForAsyncData tries to access AsyncEvent
properties. Asserting as the correct type ensures type safety without using
`any`.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
````suggestion
} else if (response.status === 202) {
waitForAsyncData(result as Parameters<typeof
waitForAsyncData>[0])
````
</div>
</details>
</div>
<small><i>Code Review Run #df1f3b</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]