-
-
Notifications
You must be signed in to change notification settings - Fork 411
Open
Labels
Status: AcceptedIt's clear what the subject of the issue is about, and what the resolution should be.It's clear what the subject of the issue is about, and what the resolution should be.🐛 BugIndicates that the issue is a bug or defect.Indicates that the issue is a bug or defect.
Description
Describe the bug
In pages/tools/components/ToolingTable.tsx (line 188), array index is being used as the key prop for mapped <tr> elements. This is a React anti-pattern that can cause rendering issues, incorrect component updates, and bugs when the list is modified (sorted, filtered, or items are added/removed).
Using array indices as keys is problematic because:
- Indices are not stable across re-renders when items are reordered, filtered, or removed
- Can cause React to incorrectly reuse component instances
- May lead to stale state and incorrect UI updates
- Negatively impacts performance and reconciliation
Steps To Reproduce
- Navigate to the
/toolspage - Open browser DevTools and observe the React component tree
- Apply filters or sorting to the tools table
- Observe that components may not update correctly due to index-based keys
- In the code, check
pages/tools/components/ToolingTable.tsxline 188 - Note the use of
indexas the key prop in the.map()function
Expected Behavior
The key prop should use a unique, stable identifier from the tool object itself instead of the array index.
Recommended fix:
{toolsByGroup[group].map((tool: JSONSchemaTool) => {
const toolKey = tool.source || tool.name || tool.url;
return (
// ✅ Using stable, unique identifier
...
);
})}
This ensures:
- Stable keys that persist across re-renders
- Correct component reconciliation
- Better performance
- Predictable behavior when sorting/filtering
Screenshots
No response
Device Information [optional]
- OS:
- Browser:
- version:Are you working on this issue?
Yes
Do you think this work might require an [Architectural Decision Record (ADR)]? (significant or noteworthy)
No
Metadata
Metadata
Assignees
Labels
Status: AcceptedIt's clear what the subject of the issue is about, and what the resolution should be.It's clear what the subject of the issue is about, and what the resolution should be.🐛 BugIndicates that the issue is a bug or defect.Indicates that the issue is a bug or defect.