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


##########
superset-frontend/src/explore/components/controls/ViewQueryModal.tsx:
##########
@@ -87,16 +89,24 @@ const ViewQueryModal: FC<Props> = ({ latestQueryFormData }) 
=> {
 
   return (
     <ViewQueryModalContainer>
-      {result.map((item, index) =>
-        item.query ? (
-          <ViewQuery
-            key={`query-${index}`}
-            datasource={latestQueryFormData.datasource}
-            sql={item.query}
-            language="sql"
-          />
-        ) : null,
-      )}
+      {result.map((item, index) => {
+        // Use content-based key when available, fall back to index
+        const key = item.query || item.error || `result-${index}`;
+        return (
+          <Fragment key={key}>

Review Comment:
   Using query or error text as a React key could cause issues if the same 
error/query appears multiple times, or if very long SQL queries are used as 
keys. Consider using a more stable identifier or always use the index-based key 
pattern.
   ```suggestion
           // Use index as key to avoid issues with duplicate or long 
query/error strings
           return (
             <Fragment key={index}>
   ```



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