Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where DataTable columns without a source prop could not be hidden using the ColumnsSelector. The fix introduces a fallback mechanism that uses the column's label (when it's a string) as the identifier for column visibility when source is undefined. Additionally, it corrects a Button API usage issue in the ColumnsSelector by changing from using children to the label prop.
Key changes:
- Columns without
sourcenow use their stringlabelas the identifier in the hidden columns logic - Button component in ColumnsSelector now correctly uses the
labelprop instead of children - Added comprehensive test coverage for columns without source
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| DataTableHeadCell.tsx | Updated to check column visibility using source ?? label fallback |
| DataTableCell.tsx | Updated to check column visibility using source ?? label fallback |
| ColumnsSelectorItem.tsx | Added validation to ensure label is a string when source is missing, and uses sourceOrLabel throughout |
| ColumnsSelector.tsx | Fixed Button usage to use label prop instead of children |
| ColumnsButton.stories.tsx | Added NoSource story to demonstrate columns without source |
| ColumnsButton.spec.tsx | Added test case for columns without source |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
slax57
approved these changes
Dec 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11087
I fixed both the bug with columns with no source and the button alignment problems.
How To Test
make runOr test in the storybook: http://localhost:9010/?path=/story/ra-ui-materialui-list-columnsbutton--no-source
Additional Checks
masterfor a bugfix or a documentation fix, ornextfor a feature