-
-
Notifications
You must be signed in to change notification settings - Fork 53
Fix issue #687 #760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue #687 #760
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThe pull request modifies the Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🔭 Outside diff range comments (2)
src/components/ui/Table/Table.tsx (2)
Line range hint
33-37: Fix key generation in table cellsThe current implementation can lead to duplicate keys when column IDs are empty strings.
columnMap.map((column:any) => { - return <TableCell key={`${row.id}-${column}`}> + return <TableCell key={`${row.id}-${column || Math.random()}`}> {row[column] || ''} </TableCell>; })However, a better solution would be to prevent this situation entirely by ensuring column IDs are always present, as suggested in the previous comments.
🧰 Tools
🪛 GitHub Actions: Build RAD UI
[warning] 11-11: Duplicate keys detected in table rows. Keys should be unique to maintain component identity across updates. Multiple rows found with keys: '', '1-', '2-', '3-', '4-'.
Test data structure needs to be updated to use 'id' instead of 'key' property
The test file is out of sync with the component implementation:
src/components/ui/Table/tests/Table.test.tsx: Update theemployeeKeyarray to useidinstead ofkeyproperty:const employeeKey = [ { key: 'id', name: 'Employee Id' }, // Should be { id: 'id', name: 'Employee Id' } { key: 'fullName', name: 'Full Name' }, // Should be { id: 'fullName', name: 'Full Name' } ... ];🔗 Analysis chain
Line range hint
1-50: Verify the impact of switching from 'key' to 'id' across the codebaseLet's ensure there are no remaining references to the old 'key' property in other components or tests.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any remaining references to column.key in the codebase rg -l "column.key" src/ # Search for any table-related test files that might need updates fd "Table.*test" src/Length of output: 92
Script:
#!/bin/bash # Check content of the test file cat src/components/ui/Table/tests/Table.test.tsx # Search for potential variations of key property access rg -i "column.*key|key.*column" src/ # Search for table column property access patterns ast-grep --pattern 'column.$_'Length of output: 2750
🧰 Tools
🪛 GitHub Actions: Build RAD UI
[warning] 11-11: Duplicate keys detected in table rows. Keys should be unique to maintain component identity across updates. Multiple rows found with keys: '', '1-', '2-', '3-', '4-'.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/components/ui/Table/Table.tsx(2 hunks)src/components/ui/Table/stories/Table.stories.js(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Build RAD UI
src/components/ui/Table/Table.tsx
[warning] 11-11: Duplicate keys detected in table rows. Keys should be unique to maintain component identity across updates. Multiple rows found with keys: '', '1-', '2-', '3-', '4-'.
🔇 Additional comments (1)
src/components/ui/Table/stories/Table.stories.js (1)
13-14: LGTM! Column and data definitions properly updatedThe changes correctly implement the switch from
keytoidproperty, maintaining consistency with the Table component changes. The test data includes proper unique IDs for each row.Also applies to: 18-21
#687
Summary by CodeRabbit
keytoididinstead ofkeyidinstead ofkeyfor validating table headers