fix(react-components): Fix style prop in DataGridCell breaking resizable columns #33503
+28
−0
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.
Fix bug where setting the style prop on a data grid cell causes column resizing to fail, and add a test for this.
Previous Behavior
When using DataGridCell with resizable columns, if the user sets the style prop on the DataGridCell, it fails to apply width to the cells.
In a Data Grid with reusable columns, even a blank style object or one with unrelated props, would stop width from being applied. For example:
New Behavior
DataGridCell should now merge styles from user-supplied component props, and resizable column data grid cell props, so that it no longer fails to apply styles or control cell width.
In the above example, this would now be merged to a final style prop including the color attribute, as well as min-width, width, etc. from the resizable columns styles.
A test has also been introduced to validate this new behaviour and guard against regressions. It checks that:
Related Issue(s)