Copilot commented on code in PR #35969:
URL: https://github.com/apache/superset/pull/35969#discussion_r2501602724
##########
superset-frontend/src/explore/components/controls/ViewQueryModal.tsx:
##########
@@ -87,16 +89,26 @@ 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) => (
+ <Fragment key={index}>
+ {item.error && (
+ <Alert
+ key={`error-${index}`}
+ type="error"
+ message={item.error}
+ closable={false}
+ />
+ )}
+ {item.query && (
+ <ViewQuery
+ key={`query-${index}`}
+ datasource={latestQueryFormData.datasource}
+ sql={item.query}
+ language={item.language}
+ />
+ )}
+ </Fragment>
+ ))}
Review Comment:
Duplicate keys are being set. The Fragment has `key={index}`, but the child
Alert and ViewQuery components also have keys (e.g., `key={`error-${index}`}`).
Since the Fragment already has a unique key, the child component keys are
unnecessary. Remove the keys from the Alert and ViewQuery components to avoid
redundancy.
--
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]