refine icon indicating copy to clipboard operation
refine copied to clipboard

[BUG] - CSV Export uses an outdated pacakge - export-to-csv-fix-source-map

Open vikavorkin opened this issue 1 year ago • 4 comments

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

  1. Load a table with the following data
[
 {"field1":"foo"}, 
 {"field1":"bar", "field2": "baz"}
]
  1. 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"]
        }
    });
  1. 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

vikavorkin avatar Nov 26 '23 17:11 vikavorkin

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 🙏

aliemir avatar Nov 27 '23 06:11 aliemir

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! 👍

vikavorkin avatar Nov 27 '23 10:11 vikavorkin

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/

omeraplak avatar Nov 27 '23 10:11 omeraplak

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.

stale[bot] avatar Jan 26 '24 11:01 stale[bot]