Skip to content

Commit 311bb60

Browse files
authored
fix(docs): update more pagination.current usages (#7251)
1 parent 91c3125 commit 311bb60

File tree

17 files changed

+35
-35
lines changed

17 files changed

+35
-35
lines changed

documentation/docs/core/interface-references/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ type CrudSort = {
100100

101101
```tsx
102102
type Pagination = {
103-
current?: number; // Initial page index
103+
currentPage?: number; // Initial page index
104104
pageSize?: number; // Initial number of items per page
105105
mode?: "client" | "server" | "off"; // Whether to use server side pagination or not.
106106
};

documentation/docs/core/refine-component/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ Form hooks like `useDrawerForm` and `useModalForm` also have a `syncWithLocation
450450
When `syncWithLocation` is active, the URL on the listing page shows query parameters like those shown below:
451451

452452
```
453-
/posts?current=1&pageSize=8&sort[]=createdAt&order[]=desc
453+
/posts?currentPage=1&pageSize=8&sort[]=createdAt&order[]=desc
454454
```
455455

456456
Users can change the current page, items count per page, and sort and filter parameters.

documentation/docs/data/data-provider/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ getList: async ({ resource, pagination, sorters, filters, meta }) => {
265265

266266
// Adjust request parameters to meet the requirements of your API
267267
const response = await apiClient.get(`/${resource}`, {
268-
params: { _page: current, _limit: pageSize },
268+
params: { _page: currentPage, _limit: pageSize },
269269
});
270270

271271
// The total row count could be sourced differently based on the provider

documentation/docs/data/hooks/use-infinite-list/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,9 @@ Consumes data from data provider `useInfiniteList` with the `getList` method. Fi
358358

359359
```ts
360360
getList: async ({ resource, pagination }) => {
361-
const { current } = pagination;
361+
const { currentPage } = pagination;
362362
const { data } = await axios.get(
363-
`https://api.fake-rest.refine.dev/${resource}?cursor=${current || 0}`,
363+
`https://api.fake-rest.refine.dev/${resource}?cursor=${currentPage || 0}`,
364364
);
365365

366366
return {
@@ -380,9 +380,9 @@ After this process, we successfully retrieved the first page of data. Let's fill
380380

381381
```ts
382382
getList: async ({ resource, pagination }) => {
383-
const { current } = pagination;
383+
const { currentPage } = pagination;
384384
const { data } = await axios.get(
385-
`https://api.fake-rest.refine.dev/${resource}?cursor=${current || 0}`,
385+
`https://api.fake-rest.refine.dev/${resource}?cursor=${currentPage || 0}`,
386386
);
387387

388388
return {

documentation/docs/data/hooks/use-list/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ useList({
135135

136136
`pagination` will be passed to the `getList` method from the `dataProvider` as a parameter. It is used to send pagination query parameters to the API.
137137

138-
#### current
138+
#### currentPage
139139

140-
You can pass the `current` page number to the `pagination` property.
140+
You can pass the `currentPage` page number to the `pagination` property.
141141

142142
```tsx
143143
useList({

documentation/docs/data/hooks/use-select/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ useSelect({
208208

209209
`pagination` will be passed to the `getList` method from the `dataProvider` as parameter. It is used to send pagination query parameters to the API.
210210

211-
#### current
211+
#### currentPage
212212

213-
You can pass the `current` page number to the `pagination` property.
213+
You can pass the `currentPage` page number to the `pagination` property.
214214

215215
```tsx
216216
useSelect({

documentation/docs/data/hooks/use-table/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ In basic usage, `useTable` returns the data as it comes from the endpoint. By de
3333

3434
## Pagination
3535

36-
`useTable` has a pagination feature. The pagination is done by passing the `current` and `pageSize` keys to `pagination` object. The `current` is the current page, and the `pageSize` is the number of records per page.
36+
`useTable` has a pagination feature. The pagination is done by passing the `currentPage` and `pageSize` keys to `pagination` object. The `currentPage` is the current page, and the `pageSize` is the number of records per page.
3737

3838
It also syncs the pagination state with the URL if you enable the [`syncWithLocation`](#syncwithlocation).
3939

40-
By default, the `current` is 1 and the `pageSize` is 10. You can change default values by passing the `pagination.currentPage` and `pagination.pageSize` props to the `useTable` hook.
40+
By default, the `currentPage` is 1 and the `pageSize` is 10. You can change default values by passing the `pagination.currentPage` and `pagination.pageSize` props to the `useTable` hook.
4141

4242
You can also change the `currentPage` and `pageSize` values by using the `setCurrentPage` and `setPageSize` functions that are returned by the `useTable` hook. Every change will trigger a new fetch.
4343

@@ -182,7 +182,7 @@ It can be `"off"`, `"server"` or `"client"`. Defaults to `"server"`.
182182

183183
- **"off":** Pagination is disabled. All records will be fetched.
184184
- **"client":** Pagination is done on the client side. All records will be fetched and then the records will be paginated on the client side.
185-
- **"server":**: Pagination is done on the server side. Records will be fetched by using the `current` and `pageSize` values.
185+
- **"server":**: Pagination is done on the server side. Records will be fetched by using the `currentPage` and `pageSize` values.
186186

187187
```tsx
188188
import { useTable } from "@refinedev/core";

documentation/docs/guides-concepts/data-fetching/data-provider-interface.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,16 +210,16 @@ const generateSort = (sorters?: CrudSorting) => {
210210
// generate query string from Refine Pagination to the format that API accepts.
211211
const generatePagination = (pagination?: Pagination) => {
212212
// pagination is optional on data hooks, so we need to set default values.
213-
const { current = 1, pageSize = 10, mode = "server" } = pagination ?? {};
213+
const { currentPage = 1, pageSize = 10, mode = "server" } = pagination ?? {};
214214

215215
const query: {
216216
_start?: number;
217217
_end?: number;
218218
} = {};
219219

220220
if (mode === "server") {
221-
query._start = (current - 1) * pageSize;
222-
query._end = current * pageSize;
221+
query._start = (currentPage - 1) * pageSize;
222+
query._end = currentPage * pageSize;
223223
}
224224

225225
return query;

documentation/docs/guides-concepts/data-fetching/use-list-with-filters.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ export const dataProvider = (url: string): DataProvider => ({
7272
}
7373
7474
// pagination is optional, so we need give default values if it is undefined.
75-
const { current = 1, pageSize = 10 } = pagination ?? {};
76-
params.push(\`_start=\${(current - 1) * pageSize}\`);
77-
params.push(\`_end=\${current * pageSize}\`);
75+
const { currentPage = 1, pageSize = 10 } = pagination ?? {};
76+
params.push(\`_start=\${(currentPage - 1) * pageSize}\`);
77+
params.push(\`_end=\${currentPage * pageSize}\`);
7878
7979
// combine all params with "&" character to create query string.
8080
const query = params.join("&");

documentation/docs/guides-concepts/routing/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ const { ... } = useTable(
380380
/my-products
381381

382382
// added-line
383-
/my-products?current=1&pageSize=2&sorters[0][field]=id&sorters[0][order]=asc&filters[0][field]=category.id&filters[0][operator]=eq&filters[0][value]=1
383+
/my-products?currentPage=1&pageSize=2&sorters[0][field]=id&sorters[0][order]=asc&filters[0][field]=category.id&filters[0][operator]=eq&filters[0][value]=1
384384
```
385385

386386
And you will see a list of products, already **filtered**, **sorted** and **paginated** automatically based on the query parameters of the **current route**.
@@ -390,7 +390,7 @@ const { result, currentPage, pageSize, filters, sorters } = useTable();
390390

391391
console.log(result.data); // [{...}, {...}]
392392
console.log(result.total); // 32 - total number of unpaginated records
393-
console.log(current); // 1 - current page
393+
console.log(currentPage); // 1 - current page
394394
console.log(pageSize); // 2 - page size
395395
console.log(filters); // [{ field: "category.id", operator: "eq", value: "1" }]
396396
console.log(sorters); // [{ field: "id", order: "asc" }]

0 commit comments

Comments
 (0)