Avoid resource loading
hey guys, I have that routes.
when I navigate to list, my list component call a different resource of
vertical-contest-notice
, but refine call both. Is there a way to avoid to call vertical-contest-notice
as resource, keep the behaviour only for component routing. I'm using nextjs.8 Replies
Hi @mandado. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the information extracts provided, you can override the default
resource
value used by the hooks in your list component by passing the resource
prop to the hook. This way, you can specify a different resource for your list component without affecting the routing behavior.
Here's an example of how to do this in your list component:
This will make your list component call the specified resource instead of the default vertical-contest-notice
resource. However, this solution assumes you're using the useTable
hook in your list component. If you're using a different hook or component, you may need to adjust the code accordingly.
For more information on overriding the default resource value, refer to this source (https://refine.dev/docs/api-reference/general-concepts#the-resource-value-is-determined-from-the-resource-prop-of-the-hook).
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------General Concepts | refine
- refine core is fully independent of UI. So you can use core components and hooks without any UI dependency.
<@121754827691786243> kapa.ai is still learning and improving, please let us how it did by reacting below
multiple-amethyst•2y ago
if i understand correctly, bot is right.
you can replace
resource
on any data hookrare-sapphire•2y ago
The problem is when I click on sidebar, refine make two requests one for vertical-constest-notice defined on resources and other for my custom resource, I want to avoid the first request
multiple-amethyst•2y ago
hmm. if you don't use any data hook, request will not send.
and what do you mean by "custom resource" ?
can you reproduce the problem on codesandbox or any other platform please ? i will happy to debug
rare-sapphire•2y ago
is there a way to define my routes and show links on sidebar without using resources with nextjs ?
multiple-amethyst•2y ago
yes, you can use this. if you are using themed layout, usages are the same
https://refine.dev/docs/faq/#how-can-i-add-an-item-to-the-sider-component