-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
📚 Subject area/topic
Routing/Pagination
📋 Page(s) affected (or suggested, for new content)
https://docs.astro.build/en/guides/routing/
https://docs.astro.build/en/reference/api-reference/#paginate
📋 Description of content that is out-of-date or incorrect
The Routing guide displays a complete API reference for the page prop related to Pagination. This reference is no longer accurate since withastro/astro#11176. The documentation has been updated in API reference (see #8751) but not in guides/routing.mdx.
There is another mistake I think. The default for page.size seems to be 10 and not 25 (see paginate.ts#L19 and paginate.ts#L80). It seems this error comes from astro/@types comment. I created a Stackblitz reproduction for this. I'll make an update there as well.
I could update the Routing guide but I wonder if this section is relevant. Since we already have the interface in API Reference, it seems duplicated (and prone to errors when new features are added). I think a link to the API Reference could make more sense:
-#### Complete API reference
-
-```ts
-interface Page<T = any> {
- /** result */
- data: T[];
- /** metadata */
- /** the count of the first item on the page, starting from 0 */
- start: number;
- /** the count of the last item on the page, starting from 0 */
- end: number;
- /** total number of results */
- total: number;
- /** the current page number, starting from 1 */
- currentPage: number;
- /** number of items per page (default: 25) */
- size: number;
- /** number of last page */
- lastPage: number;
- url: {
- /** url of the current page */
- current: string;
- /** url of the previous page (if there is one) */
- prev: string | undefined;
- /** url of the next page (if there is one) */
- next: string | undefined;
- };
-}
-```
+<ReadMore>Learn more about [`page` prop](https://docs.astro.build/en/reference/api-reference/#the-pagination-page-prop).</ReadMore>And we could add the default for pageSize/page.size to the API Reference page.
What do you think?
🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)
For the page.size issue only: https://stackblitz.com/edit/astro-paginate-pagesize?file=src%2Fpages%2Fpokemon%2F[page].astro&on=stackblitz