useExport resource prop

So currently I am in my "resource_1" list page and I am triggering export using useExport({resource:"resource_2"}) but my graphql query always goes to "resource_1". I am using refine with nhost hasura.
6 Replies
kapa.ai
kapa.ai2y ago
Hi @shubham.srv. 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 in refine infers the resource to export from the current route of the browser by default. However, you can specify the resource to export by passing the resource prop to the useExport hook. Please note that in the migration from version 3.x.x to 4.x.x of refine, the resourceName prop was deprecated and replaced with the resource prop. So, if you're using version 4.x.x or later, make sure you're using the resource prop. Here's how you can use it:
const { triggerExport } = useExport({ resource: "resource_2" });
const { triggerExport } = useExport({ resource: "resource_2" });
This should send the GraphQL query to "resource_2" instead of "resource_1". If it's still not working as expected, there might be an issue with your setup or a bug in the library. For more detailed information, you can refer to the useExport documentation (https://refine.dev/docs/api-reference/core/hooks/import-export/useExport/). If you're still facing issues, I would recommend reaching out to the refine community or support for more specific help. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2y ago
<@1003590847960449024> kapa.ai is still learning and improving, please let us know how it did by reacting below
optimistic-gold
optimistic-goldOP2y ago
refine@core version is 4.5.8 And yes I am passing a resource name to resource prop. But its still taking the resource name from the route. @kapa.ai refine@core version is 4.5.8 And yes I am passing a resource name to resource prop. But its still taking the resource name from the route.
kapa.ai
kapa.ai2y ago
Let me check the knowledge base for you. One moment! :books: ---------------------- I'm sorry to hear that you're still having trouble. Based on the information provided, it seems like there might be an issue with your setup or a potential bug in the library. The useExport hook should use the resource name provided in the resource prop, not the one from the route. If it's not behaving as expected, it might be worth checking your code for any potential errors or conflicts that might be causing this issue. If you've checked your code and the issue persists, I would recommend reaching out to the refine community or support for more specific help. They might be able to provide more insight into why this is happening and how to fix it. Unfortunately, the information provided in the extracts does not cover this specific issue, so I can't provide a more specific solution. I hope this general advice is helpful and I wish you the best of luck in resolving this issue. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2y ago
<@1003590847960449024> kapa.ai is still learning and improving, please let us know how it did by reacting below
extended-yellow
extended-yellow2y ago
Hey @shubham.srv I did a test with Codesandbox with two different resources, but I didn't see the problem you reported. Could it be a problem with the data provider? https://codesandbox.io/p/sandbox/cranky-visvesvaraya-yjjgh8

Did you find this page helpful?