refine useList returns only 10 results. With a property - total: 17

refine useList returns only 10 results. With a property - total: 17
2 Replies
kapa.ai
kapa.ai2d ago
Hi @Marchello. 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 provided in the knowledge sources, it appears that the useList hook in refine is behaving as expected. The default behavior of useList includes pagination, which limits the number of results returned in a single query. The pagination behavior you're observing (10 results returned with a total of 17) is likely due to the default page size setting. Here's how you can modify this behavior: 1. You can change the page size by setting the pagination property in the useList hook:
const { data, isLoading, isError } = useList({
resource: "your-resource",
pagination: {
pageSize: 20, // or any other number you prefer
},
});
const { data, isLoading, isError } = useList({
resource: "your-resource",
pagination: {
pageSize: 20, // or any other number you prefer
},
});
2. If you want to disable pagination entirely and fetch all results at once, you can set the pagination mode to "off":
const { data, isLoading, isError } = useList({
resource: "your-resource",
pagination: {
mode: "off",
},
});
const { data, isLoading, isError } = useList({
resource: "your-resource",
pagination: {
mode: "off",
},
});
It's important to note that the total property returned by useList represents the total number of records available, not just the number of records in the current page. This is useful for implementing pagination controls in your UI. For more detailed information on the useList hook and its pagination options, you can refer to the useList documentation. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2d ago
<@776434372299325441> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?