Copilot commented on code in PR #42318:
URL: https://github.com/apache/superset/pull/42318#discussion_r3634659170


##########
superset-frontend/src/SqlLab/components/ResultSet/index.tsx:
##########
@@ -618,7 +618,22 @@ const ResultSet = ({
   }
 
   if (query.state === QueryState.Failed) {
-    const errors = [...(query.extra?.errors || []), ...(query.errors || [])];
+    // A failed query can carry the same error in both `query.errors` (set by
+    // the queryFailed action) and `query.extra.errors` (set by the async
+    // refresh). When falling back to async polling both get populated with
+    // identical errors, so deduplicate to avoid rendering each error twice.
+    const seenErrors = new Set<string>();
+    const errors = [
+      ...(query.extra?.errors || []),
+      ...(query.errors || []),
+    ].filter(error => {
+      const key = JSON.stringify(error);
+      if (seenErrors.has(key)) {
+        return false;
+      }
+      seenErrors.add(key);
+      return true;
+    });

Review Comment:
   Using `JSON.stringify(error)` as the deduplication key can throw if any 
field contains a native `BigInt` ("Do not know how to serialize a BigInt"). 
Since the async polling path parses responses with `parseMethod: 'json-bigint'` 
and can convert large integers to `BigInt`, this can crash rendering in the 
Failed state. Use a JSON.stringify replacer (or another keying strategy) that 
stringifies BigInt values safely.



-- 
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]

Reply via email to