codeant-ai-for-open-source[bot] commented on code in PR #43793:
URL: https://github.com/apache/superset/pull/43793#discussion_r3916338609
##########
superset-frontend/src/features/alerts/AlertReportModal.tsx:
##########
@@ -759,35 +762,35 @@ const AlertReportModal:
FunctionComponent<AlertReportModalProps> = ({
ownState: {},
};
- const data = await getChartDataRequest(filterValues).then(response => {
- const rawData = response.json.result[0].data;
- let filteredData = rawData;
-
- if (vizType === 'filter_timecolumn') {
- // filter for time columns types
- filteredData = rawData.filter((item: any) => item.dtype === 2);
- }
+ const { response, json } = await getChartDataRequest(filterValues);
+ const queriesResponse = await handleChartDataResponse(response, json);
Review Comment:
No. Adding a `catch` only prevents an unhandled rejection and displays an
error when the async query genuinely fails; it does not resolve GAQ data.
The actual GAQ fix is already the call to `handleChartDataResponse(response,
json)`. For a `202` response, that helper waits for the job via
`waitForAsyncData` and resolves with the completed query result, so
`queriesResponse[0].data` is populated before options are mapped.
The promise should still be caught in `addNativeFilterOptions`, for example:
```typescript
getChartDataRequest(filterValues)
.then(({ response, json }) => handleChartDataResponse(response, json))
.then(queriesResponse => {
// Populate options from the completed async result.
})
.catch(() => {
addDangerToast(t('Failed to load dashboard filter values.'));
});
```
Thus, the required data-loading fix is `handleChartDataResponse`; the
`catch` is only failure handling. If `waitForAsyncData` rejects because the
server-side job fails, there is no valid data to populate, so retry behavior
would need to be explicitly added separately rather than silently treating the
response as empty.
--
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]