Skip to content

Commit 5030db3

Browse files
sadpandajoeclaude
andcommitted
refactor(explore): simplify React keys in ViewQueryModal to match codebase patterns
Changed from content-based keys (item.query || item.error) to index-based keys for the Fragment elements in ViewQueryModal. This aligns with established Superset patterns (e.g., MarshmallowErrorMessage.tsx) for displaying static API response data. Both approaches are technically correct for static data, but index-based is simpler and more consistent. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 7620bc8 commit 5030db3

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

superset-frontend/src/explore/components/controls/ViewQueryModal.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,9 @@ const ViewQueryModal: FC<Props> = ({ latestQueryFormData }) => {
8989

9090
return (
9191
<ViewQueryModalContainer>
92-
{result.map((item, index) => {
93-
// Use content-based key when available, fall back to index
94-
const key = item.query || item.error || `result-${index}`;
95-
return (
96-
<Fragment key={key}>
92+
{result.map((item, index) => (
93+
// Static API response data - index is appropriate for keys
94+
<Fragment key={index}>
9795
{item.error && (
9896
<Alert type="error" message={item.error} closable={false} />
9997
)}
@@ -104,9 +102,8 @@ const ViewQueryModal: FC<Props> = ({ latestQueryFormData }) => {
104102
language={item.language}
105103
/>
106104
)}
107-
</Fragment>
108-
);
109-
})}
105+
</Fragment>
106+
))}
110107
</ViewQueryModalContainer>
111108
);
112109
};

0 commit comments

Comments
 (0)