rival-black
rival-black10mo ago

uselist pagination disable

Using useList, with code like the following const { data: _all_resource_data, isLoading, isError } = useList<IBaseElement, HttpError>({ //resource: resource.name, resource: "order-items", pagination: { pageSize: 999, //mode: "off", }, }); how can i disable completely pagination and get all the results from the provider withouth pagination at all?
2 Replies
kapa.ai
kapa.ai10mo ago
Hi @DannyWhite. 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 provided extracts, there isn't a direct way to disable pagination in the useList hook. However, you can set the pageSize to a large number to fetch all data at once, as you've done in your code snippet.
const { data: _all_resource_data, isLoading, isError } = useList<IBaseElement, HttpError>({
resource: "order-items",
pagination: {
pageSize: 999,
},
});
const { data: _all_resource_data, isLoading, isError } = useList<IBaseElement, HttpError>({
resource: "order-items",
pagination: {
pageSize: 999,
},
});
This will fetch 999 records at a time, which may be sufficient if you have less than 999 records. If you have more, you would need to increase the pageSize. However, please note that fetching a large amount of data at once can have performance implications and may not be recommended depending on the size of your data and the capabilities of your server. For more information, you can refer to the useList documentation (https://refine.dev/docs/data/hooks/use-list). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai10mo ago
<@1129002557419827210> kapa.ai is still learning and improving, please let us know how it did by reacting below