Skip to content
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

[data grid] Fix CSV export for null and undefined values #14166

Merged
merged 6 commits into from
Aug 14, 2024

Conversation

k-rajat19
Copy link
Contributor

@k-rajat19 k-rajat19 commented Aug 11, 2024

Fixes #14082

this issue comes from the changes done in #13560 , the motive of that PR is to convert any non-string value into a string using template literals but it also converts null and undefined values into strings which then exported to CSV as a string.
I have added a check for these values.

@k-rajat19
Copy link
Contributor Author

k-rajat19 commented Aug 11, 2024

not sure if this check should stay here or not, it probably not
before #13560 this check was useful to opt out of null and undefined values

if (value === null || value === undefined) {
this.rowString += '';

@k-rajat19 k-rajat19 changed the title [data-grid] Fix CSV export for null and undefined values [data grid] Fix CSV export for null and undefined values Aug 11, 2024
@zannager zannager added the component: data grid This is the name of the generic UI component, not the React module! label Aug 12, 2024
@arminmeh
Copy link
Contributor

not sure if this check should stay here or not, it probably not before #13560 this check was useful to opt out of null and undefined values

if (value === null || value === undefined) {
this.rowString += '';

I have removed this, thanks for pointing it out

@arminmeh
Copy link
Contributor

I have added a test to the PR, to prevent future regressions.
Thanks for the contribution @k-rajat19

@mui-bot
Copy link

mui-bot commented Aug 12, 2024

Deploy preview: https://deploy-preview-14166--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against d03e601

@arminmeh arminmeh merged commit 496d64e into mui:master Aug 14, 2024
18 checks passed
@k-rajat19 k-rajat19 deleted the 14082 branch August 14, 2024 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Export regression A bug, but worse
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data grid] V7 CSV export regression for undefined and null values
4 participants