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
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ import { useInfiniteList } from "@refinedev/core";

const PostList = () => {
const {
data,
isError,
isLoading,
hasNextPage,
fetchNextPage,
isFetchingNextPage,
result: { data, hasNextPage, hasPreviousPage },
query: { isError, isLoading, fetchNextPage, isFetchingNextPage },
} = useInfiniteList({
resource: "categories",
pagination: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,11 @@ interface IProduct {

const ProductList: React.FC = () => {
//highlight-next-line
const [value, setValue] = useState("Cotton");
const [value, setValue] = useState("Plastic");

const {
data,
isLoading,
isError,
hasNextPage,
fetchNextPage,
isFetchingNextPage,
result: { data, hasNextPage, hasPreviousPage },
query: { isError, isLoading, fetchNextPage, isFetchingNextPage },
} = useInfiniteList<IProduct, HttpError>({
resource: "products",
//highlight-start
Expand Down Expand Up @@ -57,7 +53,7 @@ const ProductList: React.FC = () => {
{/* highlight-start */}
<span> material: </span>
<select value={value} onChange={(e) => setValue(e.target.value)}>
{["Cotton", "Bronze", "Plastic"].map((material) => (
{["Plastic", "Cotton", "Bronze"].map((material) => (
<option key={material} value={material}>
{material}
</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ const ProductList: React.FC = () => {
const [order, setOrder] = useState<"asc" | "desc">("asc");

const {
data,
isLoading,
isError,
hasNextPage,
fetchNextPage,
isFetchingNextPage,
result: { data, hasNextPage, hasPreviousPage },
query: { isError, isLoading, fetchNextPage, isFetchingNextPage },
} = useInfiniteList<IProduct, HttpError>({
resource: "products",
//highlight-start
Expand Down
6 changes: 3 additions & 3 deletions documentation/docs/data/hooks/use-infinite-list/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ useInfiniteList({

`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.

#### current
#### currentPage

You can pass the `current` page number to the `pagination` property.
You can pass the `currentPage` page number to the `pagination` property.

```tsx
useInfiniteList({
pagination: {
current: 2,
currentPage: 2,
},
});
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const ProductList: React.FC = () => {
<div>
{/* highlight-start */}
<button onClick={() => setCurrentPage((prev) => prev - 1)}>{"<"}</button>
<span> page: {current} </span>
<span> page: {currentPage} </span>
<button onClick={() => setCurrentPage((prev) => prev + 1)}>{">"}</button>
<span> per page: </span>
<select
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ setRefineProps({
resources: [
{
name: "posts",
list: PostList,
list: "/posts",
},
],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ interface IPost {
}

const PostList: React.FC = () => {
const { result, tableQuery, sorter, setSorter } = useTable<IPost, HttpError>({
const { result, tableQuery, sorters, setSorters } = useTable<
IPost,
HttpError
>({
// highlight-start
sorters: {
initial: [
Expand All @@ -42,9 +45,9 @@ const PostList: React.FC = () => {
const currentSorterOrders = useMemo(() => {
return {
createdAt:
sorter.find((item) => item.field === "createdAt")?.order || "desc",
id: sorter.find((item) => item.field === "id")?.order || "desc",
title: sorter.find((item) => item.field === "title")?.order || "asc",
sorters.find((item) => item.field === "createdAt")?.order || "desc",
id: sorters.find((item) => item.field === "id")?.order || "desc",
title: sorters.find((item) => item.field === "title")?.order || "asc",
};
}, [sorter]);
// highlight-end
Expand Down
8 changes: 5 additions & 3 deletions documentation/docs/data/packages/appwrite/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const PostList: React.FC = () => {

const categoryIds = result?.data?.map((item) => item.categoryId) ?? [];
const {
result,
result: categoriesData,
query: { isLoading },
} = CoreUseMany<ICategory>({
resource: "61c43adc284ac",
Expand Down Expand Up @@ -127,7 +127,9 @@ const PostList: React.FC = () => {

return (
<RefineAntdTextField
value={result?.data.find((item) => item.id === value)?.title}
value={
categoriesData?.data.find((item) => item.id === value)?.title
}
/>
);
}}
Expand Down Expand Up @@ -557,7 +559,7 @@ import { Table, Space } from "antd";
import { IPost, ICategory } from "interfaces";

export const PostsList: React.FC = () => {
const { result, sorter } = useTable<IPost>({
const { result, sorters, tableProps } = useTable<IPost>({
sorters: {
initial: [
{
Expand Down
4 changes: 2 additions & 2 deletions documentation/docs/getting-started/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ Offering the best from both worlds, Refine mitigates all risks of “from scratc

## Overview of the Refine structure

import { MUIExample } from './example/mui';
<!-- import { MUIExample } from './example/mui'; -->

<MUIExample />
<!-- <MUIExample /> -->

<br/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ export default function ServerSideValidationChakraUi() {
height={460}
showOpenInCodeSandbox={false}
dependencies={{
"@refinedev/chakra-ui": "^2.26.17",
"@refinedev/chakra-ui": "latest",
"@tabler/icons-react": "^3.1.0",
"@refinedev/core": "^4.45.1",
"@refinedev/core": "latest",
"@refinedev/react-router": "latest",
"@refinedev/simple-rest": "^4.5.4",
"@refinedev/react-table": "^5.6.4",
"@refinedev/simple-rest": "latest",
"@refinedev/react-table": "latest",
"@tanstack/react-table": "^8.2.6",
"@refinedev/react-hook-form": "^4.8.12",
"@refinedev/react-hook-form": "latest",
"@chakra-ui/react": "^2.5.1",
"react-dom": "^18.0.0",
"react-router": "^7.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export default function ServerSideValidationReactHookForm() {
height={460}
showOpenInCodeSandbox={false}
dependencies={{
"@refinedev/core": "^4.45.1",
"@refinedev/core": "latest",
"@refinedev/react-router": "latest",
"@refinedev/simple-rest": "^4.5.4",
"@refinedev/simple-rest": "latest",
"react-dom": "^18.0.0",
"react-router": "^7.0.2",
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ export default function ServerSideValidationMantine() {
height={460}
showOpenInCodeSandbox={false}
dependencies={{
"@refinedev/mantine": "^2.28.21",
"@refinedev/core": "^4.45.1",
"@refinedev/mantine": "latest",
"@refinedev/core": "latest",
"@refinedev/react-router": "^latest",
"@refinedev/simple-rest": "^4.5.4",
"@refinedev/react-table": "^5.6.4",
"@refinedev/simple-rest": "latest",
"@refinedev/react-table": "latest",
"@tanstack/react-table": "^8.2.6",
"@tabler/icons-react": "^3.1.0",
"@emotion/react": "^11.8.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function ServerSideValidationMui() {
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/react-router": "latest",
"@refinedev/react-hook-form": "^4.8.12",
"@refinedev/react-hook-form": "latest",
"@emotion/react": "^11.8.2",
"@emotion/styled": "^11.8.1",
"@mui/lab": "^6.0.0-beta.14",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ export default function ServerSideValidationReactHookForm() {
showOpenInCodeSandbox={false}
dependencies={{
"@tabler/icons-react": "^3.1.0",
"@refinedev/core": "^4.45.1",
"@refinedev/core": "latest",
"@refinedev/react-router": "latest",
"@refinedev/simple-rest": "^4.5.4",
"@refinedev/react-hook-form": "^4.8.12",
"@refinedev/simple-rest": "latest",
"@refinedev/react-hook-form": "latest",
"react-dom": "^18.0.0",
"react-router": "^7.0.2",
"react-hook-form": "^7.57.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const EditPage: React.FC = () => {
resource: "categories",
defaultValue: product?.category.id,
});
const categories = categoriesQueryResult?.data?.data;
const categories = categoriesQuery?.result?.data;

// find category of product by id from categories
const categoryOfProduct = categories?.find(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function UseSelectMantine() {
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/react-hook-form": "latest",
"@refinedev/mantine": "^2.28.21",
"@refinedev/mantine": "latest",
"@mantine/core": "^5.10.4",
"@mantine/notifications": "^5.10.4",
"@emotion/react": "^11.8.2",
Expand Down Expand Up @@ -109,7 +109,7 @@ export const EditPage: React.FC = () => {
resource: "categories",
defaultValue: product?.category.id,
});
const categories = categoriesQueryResult?.data?.data;
const categories = categoriesQuery?.result?.data;

// find category of product by id from categories
const categoryOfProduct = categories?.find(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const EditPage: React.FC = () => {
resource: "categories",
defaultValue: product?.category.id,
});
const categories = categoriesQueryResult?.data?.data;
const categories = categoriesQuery?.result?.data;

// find category of product by id from categories
const categoryOfProduct = categories?.find(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function NotificationChakraUI() {
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@chakra-ui/react": "^2.5.1",
"@refinedev/chakra-ui": "^2.26.17",
"@refinedev/chakra-ui": "latest",
}}
startRoute="/"
files={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function NotificationMantine() {
"@emotion/react": "^11.8.2",
"@mantine/core": "^5.10.4",
"@mantine/hooks": "^5.10.4",
"@refinedev/mantine": "^2.28.21",
"@refinedev/mantine": "latest",
}}
startRoute="/"
files={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ render(
<ReactRouter.Route index element={<PostList />} />
</ReactRouter.Route>
<ReactRouter.Route path="/posts/create" element={<PostCreate />} />
<ReactRouter.Route path="/posts/edit/:id" element={<PostEditPage />} />
</ReactRouter.Routes>
</RefineAntdDemo>
</ReactRouter.BrowserRouter>,
Expand Down Expand Up @@ -461,7 +460,6 @@ render(
<ReactRouter.Route index element={<PostList />} />
</ReactRouter.Route>
<ReactRouter.Route path="/posts/create" element={<PostCreate />} />
<ReactRouter.Route path="/posts/edit/:id" element={<PostEditPage />} />
</ReactRouter.Routes>
</RefineAntdDemo>
</ReactRouter.BrowserRouter>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ export default function AuthPage() {
// showFiles
initialPercentage={40}
dependencies={{
"@refinedev/chakra-ui": "^2.26.17",
"@refinedev/chakra-ui": "latest",
"@tabler/icons-react": "^3.1.0",
"@refinedev/core": "^4.45.1",
"@refinedev/core": "latest",
"@refinedev/react-router": "latest",
"@refinedev/simple-rest": "^4.5.4",
"@refinedev/react-table": "^5.6.4",
"@refinedev/simple-rest": "latest",
"@refinedev/react-table": "latest",
"@tanstack/react-table": "^8.2.6",
"@refinedev/react-hook-form": "^4.8.12",
"@refinedev/react-hook-form": "latest",
"@chakra-ui/react": "^2.5.1",
"react-dom": "^18.0.0",
"react-router": "^7.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ export default function BasicViews() {
showNavigator
initialPercentage={40}
dependencies={{
"@refinedev/chakra-ui": "^2.26.17",
"@refinedev/chakra-ui": "latest",
"@tabler/icons-react": "^3.1.0",
"@refinedev/core": "^4.45.1",
"@refinedev/core": "latest",
"@refinedev/react-router": "latest",
"@refinedev/simple-rest": "^4.5.4",
"@refinedev/react-table": "^5.6.4",
"@refinedev/simple-rest": "latest",
"@refinedev/react-table": "latest",
"@tanstack/react-table": "^8.2.6",
"@refinedev/react-hook-form": "^4.8.12",
"@refinedev/react-hook-form": "latest",
"@chakra-ui/react": "^2.5.1",
"react-dom": "^18.0.0",
"react-router": "^7.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function Example() {
"@refinedev/core": "^5.0.0",
"@refinedev/react-router": "latest",
"@refinedev/simple-rest": "^6.0.0",
"@refinedev/react-table": "^6.0.1",
"@refinedev/react-table": "latest",
"@tanstack/react-table": "^8.2.6",
"@refinedev/react-hook-form": "^5.0.2",
"@chakra-ui/react": "^2.5.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ export default function LayoutNextjs() {
showNavigator
hidePreview
dependencies={{
"@refinedev/chakra-ui": "^2.26.17",
"@refinedev/chakra-ui": "latest",
"@tabler/icons-react": "^3.1.0",
"@refinedev/core": "^4.45.1",
"@refinedev/core": "latest",
"@refinedev/react-router": "latest",
"@refinedev/simple-rest": "^4.5.4",
"@refinedev/react-table": "^5.6.4",
"@refinedev/simple-rest": "latest",
"@refinedev/react-table": "latest",
"@tanstack/react-table": "^8.2.6",
"@refinedev/react-hook-form": "^4.8.12",
"@refinedev/react-hook-form": "latest",
"@chakra-ui/react": "^2.5.1",
"@refinedev/nextjs-router": "latest",
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ export default function LayoutReactRouterDom() {
// showFiles
initialPercentage={35}
dependencies={{
"@refinedev/chakra-ui": "^2.26.17",
"@refinedev/chakra-ui": "latest",
"@tabler/icons-react": "^3.1.0",
"@refinedev/core": "^4.45.1",
"@refinedev/core": "latest",
"@refinedev/react-router": "latest",
"@refinedev/simple-rest": "^4.5.4",
"@refinedev/react-table": "^5.6.4",
"@refinedev/simple-rest": "latest",
"@refinedev/react-table": "latest",
"@tanstack/react-table": "^8.2.6",
"@refinedev/react-hook-form": "^4.8.12",
"@refinedev/react-hook-form": "latest",
"@chakra-ui/react": "^2.5.1",
"react-dom": "^18.0.0",
"react-router": "^7.0.2",
Expand Down
Loading
Loading