Skip to content

Commit

Permalink
fix: consume the bignumber.js reversion -- apply the bignumber conver…
Browse files Browse the repository at this point in the history
…sion in `actions/sqlLab.js` where it is needed (aka opt into bignumber.js).
  • Loading branch information
xtinec committed Apr 3, 2019
1 parent f1a33be commit 1912b6c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions superset/assets/src/SqlLab/actions/sqlLab.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* under the License.
*/
import shortid from 'shortid';
import JSONbig from 'json-bigint';
import { t } from '@superset-ui/translation';
import { SupersetClient } from '@superset-ui/connection';

Expand Down Expand Up @@ -128,9 +129,11 @@ export function fetchQueryResults(query) {

return SupersetClient.get({
endpoint: `/superset/results/${query.resultsKey}/`,
parseMethod: 'text',
})
.then(({ json = {} }) => {
dispatch(querySuccess(query, json));
.then(({ text = '{}' }) => {
const bigIntJson = JSONbig.parse(text);
dispatch(querySuccess(query, bigIntJson));
})
.catch(response =>
getClientErrorObject(response).then((error) => {
Expand Down Expand Up @@ -164,10 +167,12 @@ export function runQuery(query) {
endpoint: `/superset/sql_json/${window.location.search}`,
postPayload,
stringify: false,
parseMethod: 'text',
})
.then(({ json }) => {
.then(({ text = '{}' }) => {
if (!query.runAsync) {
dispatch(querySuccess(query, json));
const bigIntJson = JSONbig.parse(text);
dispatch(querySuccess(query, bigIntJson));
}
})
.catch(response =>
Expand Down

0 comments on commit 1912b6c

Please sign in to comment.