refine
refine copied to clipboard
[BUG] - CSV Export uses an outdated pacakge - export-to-csv-fix-source-map
Describe the bug
Current version of the export-to-csv package is [email protected]
This version has a bug where not all headers are exported and it depends on the first data item.
This issue affect @refinedev/core since useExport was added @ 8a115b5f
Steps To Reproduce
- Load a table with the following data
[
{"field1":"foo"},
{"field1":"bar", "field2": "baz"}
]
- Export a CSV using
const { triggerExport, isLoading } = useExport<IVendor>({
mapData: item => flatten(item),
exportOptions: {
showLabels: true,
// There is an issue if the first item in the list is missing a keys, no column will be generated for them.
// Manually defining the keys
useKeysAsHeaders: false,
headers: ["field1", "field2"]
}
});
- CSV will not contain "field2"
Expected behavior
Specifying the headers for the CSV should export all the headers without depending on the actual data for the keys.
Screenshot
No response
Desktop
No response
Mobile
No response
Additional Context
No response
Hey @vikavorkin, sorry for the issue! export-to-csv-fix-source-map was a fix for webpack back then, now it's most likely not needed. We can switch to export-to-csv and fix this issue. We'll be happy to accept your contribution if you want to open up a PR for this 🙏
Hi @aliemir, I will gladly open a PR, will take me some time to get to it. The current parameters look to match the latest version so I expect no breaking changes.
Will update, thanks for the quick answer! 👍
Hi @aliemir, I will gladly open a PR, will take me some time to get to it. The current parameters look to match the latest version so I expect no breaking changes.
Will update, thanks for the quick answer! 👍
Thank you, I have assigned the issue to you. You can take a look at our Contributing document at https://refine.dev/docs/contributing/
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.