[DOC]: clarify rowCount retrieval and improve pagination examples
lnikitadobrenkol opened this issue · 0 comments
Documentation issue
The issue relates to existing sections of the documentation concerning data fetching hooks. The current documentation lacks explicit details on how Refine retrieves the total row count for paginated data via the x-total-count
header.
Links to relevant sections:
- useList Hook Documentation
- useInfiniteList Hook Documentation
- Cursor-Based Pagination Guide in
useInfiniteList
Describe the thing to improve
Currently, the Refine documentation lacks explicit information on how the rowCount
for paginated data is retrieved from server-side pagination. More specifically:
- It isn't clear how Refine determines
rowCount
if it's not explicitly provided by the backend. - Developers may be confused regarding the behaviour of the
useList
anduseInfiniteList
hooks with server-side pagination. - The documentation does not provide sufficient details on the use of the
x-total-count
header or fallback mechanisms for obtaining the total count of rows.
Suggested Improvements:
-
Clarify Documentation in Hook Guides:
- Add a dedicated section to the
useList
anduseInfiniteList
hook guides explaining how the total row count is retrieved using thex-total-count
header. - Include examples or code snippets demonstrating proper usage.
- Add a dedicated section to the
-
Update Data Fetching Guide:
- In the data fetching guide, provide a thorough explanation of the
getList
method and how it handles paginated data and total row count retrieval. - Explain the fallback mechanism used if the
x-total-count
header is absent.
- In the data fetching guide, provide a thorough explanation of the
These additions will provide clear guidance to developers on how Refine determines the rowCount
and how to ensure accurate pagination data is fetched.
Describe the solution (optional)
To improve the experience of beginners and readers, consider these solutions:
-
Add Detailed Explanations:
- Hook Guides: Include a new sub-section in the
useList
anduseInfiniteList
hook guides specifically covering how Refine retrieves therowCount
from thex-total-count
header during server-side pagination. Make it clear how the total count is obtained, even when not directly provided by the backend, and describe the fallback mechanism. - Data Fetching Guide: Update the guide to include a step-by-step explanation of the
getList
method's behavior. Emphasize its role in data retrieval, including how it ensures accurate pagination.
- Hook Guides: Include a new sub-section in the
-
Provide Code Examples:
- Add practical examples demonstrating how the
x-total-count
header is used within a real-world data provider implementation, including cursor-based pagination. - Highlight the fallback logic when the header is absent, providing best practices for consistent data retrieval.
- Add practical examples demonstrating how the
-
Cross-Link Pages:
- Ensure consistent cross-referencing between the hooks documentation and the data fetching guide so readers can easily find all relevant details.
-
General Grammar Fixes:
- Review the existing documentation for minor grammar issues and fix where appropriate.