Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions documentation/blog/2024-12-24-react-dnd.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ function useData() {
} = useList<IProduct>({
config: {
pagination: {
current: 2,
currentPage: 2,
},
},
resource: "products",
Expand Down Expand Up @@ -435,7 +435,7 @@ const {
} = useList<IProduct>({
config: {
pagination: {
current: 2,
currentPage: 2,
},
},
resource: "products",
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/data/hooks/use-list/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ You can pass the `current` page number to the `pagination` property.
```tsx
useList({
pagination: {
current: 2,
currentPage: 2,
},
});
```
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/data/hooks/use-select/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ You can pass the `current` page number to the `pagination` property.
```tsx
useSelect({
pagination: {
current: 2,
currentPage: 2,
},
});
```
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/data/hooks/use-table/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Sets the initial value of the page index. Defaults to `1`.
import { useTable } from "@refinedev/core";
useTable({
pagination: {
current: 2,
currentPage: 2,
},
});
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ export const myDataProvider: CreateDataProviderOptions = {
const query: Record<string, any> = {};

// Handle pagination
// Refine provides: { current: 1, pageSize: 10 }
// Refine provides: { currentPage: 1, pageSize: 10 }
// API expects: ?page=1&size=10
query.page = pagination?.current ?? 1;
query.page = pagination?.currentPage ?? 1;
query.size = pagination?.pageSize ?? 10;

// Handle sorting
Expand Down Expand Up @@ -212,7 +212,7 @@ export const myDataProvider: CreateDataProviderOptions = {
With this implementation, you've created a complete bridge between Refine and your API. Here's what happens when a user interacts with your list component:

1. **User action**: User clicks "next page", sorts a column, or applies a filter (like searching for "Published" posts)
2. **Refine processes**: Refine calculates new parameters (`current: 2`, `pageSize: 10`, `filters: [{ field: "status", operator: "eq", value: "PUBLISHED" }]`)
2. **Refine processes**: Refine calculates new parameters (`currentPage: 2`, `pageSize: 10`, `filters: [{ field: "status", operator: "eq", value: "PUBLISHED" }]`)
3. **Your transformation**: `buildQueryParams` converts these to `?page=2&size=10&status=PUBLISHED`
4. **API call**: Request goes to `https://example.com/posts?page=2&size=10&status=PUBLISHED`
5. **Response processing**: `mapResponse` extracts the data array, `getTotalCount` extracts the total
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ import { DataProvider, useList } from "@refinedev/core";
useList({
resource: "products",
pagination: {
current: 1,
currentPage: 1,
pageSize: 10,
},
filters: [
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/guides-concepts/realtime/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ useSubscription({
params: {
resource: "posts",
pagination: {
current: 1,
currentPage: 1,
pageSize: 10,
},
subscriptionType: "useList",
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/guides-concepts/routing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ We can pass these parameters to `useTable` hook as follows:
```ts
const { ... } = useTable(
{
current: 1,
currentPage: 1,
pageSize: 2,
filters: { initial: [{ field: "category.id", operator: "eq", value: 1 }]},
sorters: { initial: [{ field: "id", direction: "asc" }] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ You can pass the `current` page number to the `pagination` property.
```tsx
useSelect({
pagination: {
current: 2,
currentPage: 2,
},
});
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ You can pass the `current` page number to the `pagination` property.
```tsx
useSelect({
pagination: {
current: 2,
currentPage: 2,
},
});
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ You can pass the `current` page number to the `pagination` property.
```tsx
useAutocomplete({
pagination: {
current: 2,
currentPage: 2,
},
});
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ICategory, IPost } from "interfaces";
const PostsList: React.FC = () => {
const { dataGridProps } = useDataGrid<IPost>({
pagination: {
current: 2,
currentPage: 2,
pageSize: 10,
},
sorters: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ const ShowcaseCRM = ({ className }: { className?: string }) => {
const { data } = useTable({
resource: "activities",
pagination: {
current: 1,
currentPage: 1,
pageSize: 5,
},
});
Expand Down Expand Up @@ -475,7 +475,7 @@ const ShowcaseHR = ({ className }: { className?: string }) => {

const { result: { data } } = useList({
resource: "time-offs",
pagination: { current: 1, pageSize: 1 },
pagination: { currentPage: 1, pageSize: 1 },
filters: [
{
field: "employeeId",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7177,7 +7177,7 @@
"type": "code",
"lang": "tsx",
"meta": null,
"value": "import { DataProvider, useList } from \"@refinedev/core\";\n\nuseList({\n resource: \"products\",\n pagination: {\n current: 1,\n pageSize: 10,\n },\n filters: [\n {\n operator: \"and\",\n value: [\n { field: \"material\", operator: \"eq\", value: \"wooden\" },\n { field: \"category.id\", operator: \"eq\", value: 45 },\n ],\n },\n {\n operator: \"or\",\n value: [\n { field: \"price\", operator: \"gte\", value: 1000 },\n { field: \"price\", operator: \"lte\", value: 2000 },\n ],\n },\n ],\n});",
"value": "import { DataProvider, useList } from \"@refinedev/core\";\n\nuseList({\n resource: \"products\",\n pagination: {\n currentPage: 1,\n pageSize: 10,\n },\n filters: [\n {\n operator: \"and\",\n value: [\n { field: \"material\", operator: \"eq\", value: \"wooden\" },\n { field: \"category.id\", operator: \"eq\", value: 45 },\n ],\n },\n {\n operator: \"or\",\n value: [\n { field: \"price\", operator: \"gte\", value: 1000 },\n { field: \"price\", operator: \"lte\", value: 2000 },\n ],\n },\n ],\n});",
"position": {
"start": {
"line": 240,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7109,7 +7109,7 @@
"type": "code",
"lang": "tsx",
"meta": null,
"value": "import { DataProvider, useList } from \"@refinedev/core\";\n\nuseList({\n resource: \"products\",\n pagination: {\n current: 1,\n pageSize: 10,\n },\n filters: [\n {\n operator: \"and\",\n value: [\n { field: \"material\", operator: \"eq\", value: \"wooden\" },\n { field: \"category.id\", operator: \"eq\", value: 45 },\n ],\n },\n {\n operator: \"or\",\n value: [\n { field: \"price\", operator: \"gte\", value: 1000 },\n { field: \"price\", operator: \"lte\", value: 2000 },\n ],\n },\n ],\n});",
"value": "import { DataProvider, useList } from \"@refinedev/core\";\n\nuseList({\n resource: \"products\",\n pagination: {\n currentPage: 1,\n pageSize: 10,\n },\n filters: [\n {\n operator: \"and\",\n value: [\n { field: \"material\", operator: \"eq\", value: \"wooden\" },\n { field: \"category.id\", operator: \"eq\", value: 45 },\n ],\n },\n {\n operator: \"or\",\n value: [\n { field: \"price\", operator: \"gte\", value: 1000 },\n { field: \"price\", operator: \"lte\", value: 2000 },\n ],\n },\n ],\n});",
"position": {
"start": {
"line": 240,
Expand Down