flat-fuchsia
flat-fuchsia8mo ago

useExport not downloading, no error

This is my current code When i press the export button the query sent to the graphql and receive a valid response, but the download do not start and no error in console
2 Replies
kapa.ai
kapa.ai8mo ago
Hi @Ennis. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The useExport hook from Refine is designed to export data as a CSV file by calling the getList method of your data provider and downloading the data as a CSV file. If you're not seeing any errors in the console and the GraphQL query is returning the expected data, it's possible that the issue lies with the download property of the useExport hook or the way the data is being parsed. Here are a few things you can check: 1. Download Property: By default, the download property of the useExport hook is set to true, which means it should automatically generate a download of the CSV file in browser environments. If this property has been set to false, the download will not occur. Check your useExport hook to ensure that the download property is set to true or is not included (which will default it to true). source (https://refine.dev/docs/core/hooks/utilities/use-export#download)
useExport({
download: true,
});
useExport({
download: true,
});
2. Data Parsing: The useExport hook uses the data returned from the getList method of your data provider to generate the CSV file. If the data structure of the returned data is not what the useExport hook is expecting, it may not be able to parse the data correctly, which could prevent the download from occurring. Ensure that the data returned from your GraphQL query matches the expected data structure. source (https://discord.com/channels/837692625737613362/1122238854376734822) 3. Triggering the Export: The useExport hook provides a triggerExport function that you can use to manually trigger the export process. This function should be called when the export button is clicked. Check your button's onClick handler to ensure that it's calling the triggerExport function. source (https://refine.dev/docs/core/hooks/utilities/use-export#triggerexport)
const { triggerExport } = useExport();

return <button onClick={triggerExport}>Export Button</button>;
const { triggerExport } = useExport();

return <button onClick={triggerExport}>Export Button</button>;
If none of these suggestions resolve the issue, it would be helpful to have a more detailed look at your code to provide more specific guidance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai8mo ago
<@293351642122944512> kapa.ai is still learning and improving, please let us know how it did by reacting below