geido commented on a change in pull request #16928:
URL: https://github.com/apache/superset/pull/16928#discussion_r720226544
##########
File path: superset-frontend/src/chart/chartAction.js
##########
@@ -394,15 +394,17 @@ export function exploreJSON(
const chartDataRequestCaught = chartDataRequest
.then(({ response, json }) => {
if (isFeatureEnabled(FeatureFlag.GLOBAL_ASYNC_QUERIES)) {
- // deal with getChartDataRequest transforming the response data
- const result = 'result' in json ? json.result[0] : json;
+ const result = 'result' in json ? json.result : json;
switch (response.status) {
case 200:
- // Query results returned synchronously, meaning query was
already cached.
- return Promise.resolve([result]);
+ return Promise.resolve(result);
case 202:
- // Query is running asynchronously and we must await the results
- return waitForAsyncData(result);
+ if (shouldUseLegacyApi(formData)) {
+ // Query is running asynchronously and we must await the
results
+ return waitForAsyncData(result[0]);
+ } else {
+ return waitForAsyncData(result);
+ }
Review comment:
```suggestion
if (shouldUseLegacyApi(formData)) {
// Query is running asynchronously and we must await the
results
return waitForAsyncData(result[0]);
}
return waitForAsyncData(result);
```
--
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]