bito-code-review[bot] commented on code in PR #44044:
URL: https://github.com/apache/superset/pull/44044#discussion_r4079304061
##########
superset-frontend/packages/superset-ui-core/src/connection/callApi/parseResponse.ts:
##########
@@ -61,8 +61,13 @@ export default async function parseResponse<T extends
ParseMethod = 'json'>(
(value?.isGreaterThan?.(Number.MAX_SAFE_INTEGER) ||
value?.isLessThan?.(Number.MIN_SAFE_INTEGER))
) {
- // toFixed() avoids scientific notation, which BigInt() rejects.
- return BigInt(value.toFixed());
+ // Return as a decimal string to preserve full precision without
+ // producing a native bigint, which JSON.stringify cannot serialize
+ // (crashes ag-Grid, Redux DevTools, clipboard copy, and any other
+ // downstream consumer that calls JSON.stringify on result rows).
+ // bignumber.js .toFixed() always returns a non-scientific decimal
+ // string for integers, regardless of magnitude, so this is safe.
+ return value.toFixed();
Review Comment:
<!-- Bito Reply -->
The suggestion to remove the now-unreachable `typeof value === 'bigint'`
guards is appropriate. Since the current PR changes the logic to return decimal
strings instead of native `bigint` values, these guards are indeed dead code
and their removal would improve code cleanliness and maintainability.
**superset-frontend/packages/superset-ui-core/src/connection/callApi/parseResponse.ts**
```
// bignumber.js .toFixed() always returns a non-scientific decimal
// string for integers, regardless of magnitude, so this is safe.
return value.toFixed();
```
--
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]