From d47d49e74c6838dc7444646b77c354ad3a9b1ae8 Mon Sep 17 00:00:00 2001 From: Alican Erdurmaz Date: Tue, 23 Jul 2024 07:21:36 +0300 Subject: [PATCH] feat: refactor tableQueryResult name to tableQuery --- .changeset/itchy-dancers-walk.md | 12 ++++ .changeset/rich-swans-prove.md | 12 ++++ .changeset/sixty-countries-nail.md | 21 ++++++ .../blog/2022-03-22-refine-with-react95.md | 2 +- .../blog/2023-01-17-airtable-crud-app.md | 14 ++-- .../blog/2023-04-13-refine-invoicer-4.md | 2 +- .../2023-07-02-refine-tremor-dashboard.md | 14 ++-- .../2023-07-26-refine-primereact-dashboard.md | 72 +++++++++---------- .../blog/2023-09-06-daisy-ui-panel.md | 2 +- .../blog/2023-09-20-next-ui-panel.md | 68 +++++++++--------- documentation/blog/2023-10-31-react-table.md | 4 +- documentation/blog/2024-03-19-ts-shadcn.md | 6 +- .../blog/2024-06-25-next-refine-pwa.md | 10 +-- .../_partial-basic-usage-live-preview.md | 6 +- .../_partial-filtering-live-preview.md | 9 +-- .../_partial-pagination-live-preview.md | 6 +- .../_partial-relational-data-live-preview.md | 6 +- .../_partial-sorting-live-preview.md | 6 +- .../docs/data/hooks/use-table/index.md | 26 ++++--- .../docs/data/packages/supabase/index.md | 2 +- .../docs/guides-concepts/faq/index.md | 2 +- .../general-concepts/layout/mantine.tsx | 2 +- .../docs/guides-concepts/routing/index.md | 6 +- .../routing/nextjs/use-table-usage.tsx | 4 +- .../routing/react-router/use-table-usage.tsx | 4 +- .../routing/remix/use-table-usage.tsx | 4 +- .../guides-concepts/tables/example/core.tsx | 6 +- .../tables/example/filtering.tsx | 6 +- .../tables/example/pagination.tsx | 6 +- .../tables/example/relationship.tsx | 6 +- .../tables/example/sorting.tsx | 6 +- .../react-hook-form/use-form/index.md | 4 +- .../react-hook-form/use-modal-form/index.md | 18 ++--- .../react-hook-form/use-steps-form/index.md | 6 +- .../_partial-relational-live-preview.md | 2 +- .../tanstack-table/use-table/index.md | 2 +- .../routing/integrations/next-js/index.md | 10 +-- .../docs/routing/integrations/remix/index.md | 6 +- .../hooks/use-editable-table/index.md | 2 +- .../ant-design/hooks/use-simple-list/index.md | 22 +++--- .../ant-design/hooks/use-table/index.md | 42 ++++++----- .../chakra-ui/introduction/index.md | 2 +- .../introduction/previews/auth-page.tsx | 2 +- .../introduction/previews/basic-views.tsx | 2 +- .../introduction/previews/example.tsx | 2 +- .../introduction/previews/layout-next-js.tsx | 2 +- .../previews/layout-react-router-dom.tsx | 2 +- .../introduction/previews/layout-remix.tsx | 2 +- .../introduction/previews/theming.tsx | 2 +- .../introduction/previews/usage-next-js.tsx | 2 +- .../previews/usage-react-router-dom.tsx | 2 +- .../introduction/previews/usage-remix.tsx | 2 +- .../mantine/hooks/use-drawer-form/index.md | 4 +- .../mantine/hooks/use-modal-form/index.md | 6 +- .../mantine/hooks/use-steps-form/index.md | 2 +- .../mantine/introduction/index.md | 2 +- .../introduction/previews/auth-page.tsx | 2 +- .../introduction/previews/basic-views.tsx | 2 +- .../mantine/introduction/previews/example.tsx | 2 +- .../introduction/previews/layout-next-js.tsx | 2 +- .../previews/layout-react-router-dom.tsx | 2 +- .../introduction/previews/layout-remix.tsx | 2 +- .../mantine/introduction/previews/theming.tsx | 2 +- .../introduction/previews/usage-next-js.tsx | 2 +- .../previews/usage-react-router-dom.tsx | 2 +- .../introduction/previews/usage-remix.tsx | 2 +- .../components/buttons/delete-button/index.md | 4 +- .../material-ui/hooks/use-data-grid/index.md | 8 ++- .../data-provider-integration/index.md | 2 +- .../data-provider-integration/sandpack.tsx | 2 +- .../tutorial/essentials/tables/index.md | 8 +-- .../tutorial/essentials/tables/sandpack.tsx | 8 +-- .../react-router/index.md | 2 +- .../react-router/sandpack.tsx | 2 +- .../routing/navigation/react-router/index.md | 2 +- .../navigation/react-router/sandpack.tsx | 2 +- .../syncing-state/react-router/index.md | 2 +- .../syncing-state/react-router/sandpack.tsx | 2 +- .../app-crm/src/routes/companies/list.tsx | 7 +- examples/app-crm/src/routes/contacts/list.tsx | 7 +- examples/app-crm/src/routes/quotes/list.tsx | 7 +- .../src/pages/posts/list.tsx | 4 +- .../auth-chakra-ui/src/pages/posts/list.tsx | 2 +- .../auth-mantine/src/pages/posts/list.tsx | 2 +- .../base-chakra-ui/src/pages/posts/list.tsx | 2 +- .../base-mantine/src/pages/posts/list.tsx | 2 +- examples/blog-ecommerce/pages/index.tsx | 8 +-- examples/blog-next-refine-pwa/pages/index.tsx | 4 +- .../src/pages/post/list.tsx | 2 +- .../src/components/table/RecentSalesTable.tsx | 4 +- .../src/pages/categories/list.tsx | 4 +- .../src/pages/products/list.tsx | 4 +- .../dashboard/recentSales/index.tsx | 6 +- .../src/pages/categories/list.tsx | 6 +- .../src/pages/products/list.tsx | 6 +- .../src/components/table/data-table.tsx | 2 +- .../src/pages/blog-posts/list.tsx | 2 +- .../src/pages/dashboard/details/index.tsx | 2 +- .../blog-win95/src/pages/categories/list.tsx | 6 +- examples/blog-win95/src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../dashboard/orderTimeline/index.tsx | 26 ++++--- .../components/product/list-card/index.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 4 +- .../src/pages/posts/list.tsx | 4 +- .../src/pages/posts/list.tsx | 6 +- .../src/pages/posts/list.tsx | 4 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/all-properties.tsx | 2 +- .../src/components/product/product-cards.tsx | 4 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- examples/store/pages/index.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../table-handson/src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/table/index.tsx | 2 +- .../src/pages/posts/list.tsx | 4 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/blog-posts/list.tsx | 2 +- .../src/pages/blog-posts/list.tsx | 2 +- .../src/pages/blog-posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/pages/posts/list.tsx | 2 +- .../src/components/table-members/index.tsx | 2 +- .../src/routes/video-club/members/list.tsx | 2 +- .../routes/video-club/tapes/select-member.tsx | 2 +- .../routes/video-club/tapes/select-title.tsx | 2 +- .../src/routes/video-club/titles/list.tsx | 2 +- .../src/pages/posts/list.tsx | 4 +- .../list/useSimpleList/useSimpleList.spec.ts | 16 +++++ .../hooks/list/useSimpleList/useSimpleList.ts | 8 ++- .../hooks/table/useTable/useTable.spec.tsx | 18 ++++- .../antd/src/hooks/table/useTable/useTable.ts | 2 + .../core/src/hooks/useTable/index.spec.ts | 16 +++++ packages/core/src/hooks/useTable/index.ts | 5 ++ .../mui/src/hooks/useDataGrid/index.spec.ts | 21 ++++++ packages/mui/src/hooks/useDataGrid/index.ts | 2 + packages/react-table/src/useTable/index.ts | 2 +- 155 files changed, 501 insertions(+), 378 deletions(-) create mode 100644 .changeset/itchy-dancers-walk.md create mode 100644 .changeset/rich-swans-prove.md create mode 100644 .changeset/sixty-countries-nail.md diff --git a/.changeset/itchy-dancers-walk.md b/.changeset/itchy-dancers-walk.md new file mode 100644 index 000000000000..5839fea432f5 --- /dev/null +++ b/.changeset/itchy-dancers-walk.md @@ -0,0 +1,12 @@ +--- +"@refinedev/core": minor +--- + +feat: [`useTable`](https://refine.dev/docs/data/hooks/use-table/)'s `tableQueryResult` is deprecated, use `tableQuery` instead. #6169 + +```diff +import { useTable } from '@refinedev/core'; + +- const { tableQueryResult } = useTable(); ++ const { tableQuery } = useTable(); +``` diff --git a/.changeset/rich-swans-prove.md b/.changeset/rich-swans-prove.md new file mode 100644 index 000000000000..6d56cc9e4f3b --- /dev/null +++ b/.changeset/rich-swans-prove.md @@ -0,0 +1,12 @@ +--- +"@refinedev/mui": minor +--- + +feat: [`useDataGrid`](https://refine.dev/docs/ui-integrations/material-ui/hooks/use-data-grid/)'s `tableQueryResult` is deprecated, use `tableQuery` instead. #6169 + +```diff +import { useDataGrid } from '@refinedev/mui'; + +- const { tableQueryResult } = useDataGrid(); ++ const { tableQuery } = useDataGrid(); +``` diff --git a/.changeset/sixty-countries-nail.md b/.changeset/sixty-countries-nail.md new file mode 100644 index 000000000000..e7d29d4f19ae --- /dev/null +++ b/.changeset/sixty-countries-nail.md @@ -0,0 +1,21 @@ +--- +"@refinedev/antd": minor +--- + +feat: [`useTable`](https://refine.dev/docs/ui-integrations/ant-design/hooks/use-table/)'s `tableQueryResult` is deprecated, use `tableQuery` instead. #6169 + +```diff +import { useTable } from '@refinedev/core'; + +- const { tableQueryResult } = useTable(); ++ const { tableQuery } = useTable(); +``` + +feat: [`useSimpleList`](https://refine.dev/docs/ui-integrations/ant-design/hooks/use-simple-list/)'s `queryResult` is deprecated, use `query` instead. #6169 + +```diff +import { useSimpleList } from '@refinedev/antd'; + +- const { queryResult } = useSimpleList(); ++ const { query } = useSimpleList(); +``` diff --git a/documentation/blog/2022-03-22-refine-with-react95.md b/documentation/blog/2022-03-22-refine-with-react95.md index a432dd519895..363ab0a61aa0 100644 --- a/documentation/blog/2022-03-22-refine-with-react95.md +++ b/documentation/blog/2022-03-22-refine-with-react95.md @@ -1055,7 +1055,7 @@ export const PostList = () => { setPageIndex, setPageSize, refineCore: { - tableQueryResult: { isLoading }, + tableQuery: { isLoading }, }, } = useTable({ columns, diff --git a/documentation/blog/2023-01-17-airtable-crud-app.md b/documentation/blog/2023-01-17-airtable-crud-app.md index 0dd0bf5cfd58..87e432da8da7 100644 --- a/documentation/blog/2023-01-17-airtable-crud-app.md +++ b/documentation/blog/2023-01-17-airtable-crud-app.md @@ -329,7 +329,7 @@ export const Layout: React.FC = ({ children }) => { const { push } = useNavigation(); return ( -
+
@@ -561,7 +561,7 @@ export const PostList: React.FC = () => { {flexRender( header.column.columnDef.header, @@ -580,7 +580,7 @@ export const PostList: React.FC = () => { return ( {flexRender( cell.column.columnDef.cell, @@ -684,7 +684,7 @@ export const PostList: React.FC = () => { getRowModel, setOptions, refineCore: { - tableQueryResult: { data: tableData }, + tableQuery: { data: tableData }, }, } = useTable({ columns }); @@ -726,7 +726,7 @@ export const PostList: React.FC = () => { {flexRender( header.column.columnDef.header, @@ -745,7 +745,7 @@ export const PostList: React.FC = () => { return ( {flexRender( cell.column.columnDef.cell, @@ -1526,7 +1526,7 @@ export const PostList: React.FC = () => { getRowModel, setOptions, refineCore: { - tableQueryResult: { data: tableData }, + tableQuery: { data: tableData }, }, getState, setPageIndex, diff --git a/documentation/blog/2023-04-13-refine-invoicer-4.md b/documentation/blog/2023-04-13-refine-invoicer-4.md index 29559aa22c9c..8d47d06f9aae 100644 --- a/documentation/blog/2023-04-13-refine-invoicer-4.md +++ b/documentation/blog/2023-04-13-refine-invoicer-4.md @@ -867,7 +867,7 @@ Endowed a due patience, we can see this in action among many others in the `@ref ```tsx title="node_modules/@refinedev/antd/src/hooks/table/useTable/useTable.ts" const { - tableQueryResult, + tableQuery, current, setCurrent, pageSize, diff --git a/documentation/blog/2023-07-02-refine-tremor-dashboard.md b/documentation/blog/2023-07-02-refine-tremor-dashboard.md index c56cfb4968c1..4bef0482a22a 100644 --- a/documentation/blog/2023-07-02-refine-tremor-dashboard.md +++ b/documentation/blog/2023-07-02-refine-tremor-dashboard.md @@ -170,7 +170,7 @@ const currencyFormatter = Intl.NumberFormat("en-US", { }); export default () => ( - + Revenue {currencyFormatter.format(3_500)} @@ -597,7 +597,7 @@ export const DashboardPage: React.FC = () => { - +
@@ -842,7 +842,7 @@ export const DashboardPage: React.FC = () => { - + //highlight-start -
+
); @@ -1246,7 +1246,7 @@ export const Details = () => { getHeaderGroups, getRowModel, refineCore: { - tableQueryResult: { data: tableData }, + tableQuery: { data: tableData }, }, getState, setPageIndex, @@ -1402,7 +1402,7 @@ export const Details = () => { { const { value } = e.target; diff --git a/documentation/blog/2023-07-26-refine-primereact-dashboard.md b/documentation/blog/2023-07-26-refine-primereact-dashboard.md index 246545b5e009..3f0c58d209ad 100644 --- a/documentation/blog/2023-07-26-refine-primereact-dashboard.md +++ b/documentation/blog/2023-07-26-refine-primereact-dashboard.md @@ -220,7 +220,7 @@ import { Button } from "primereact/Button"; export const Dashboard = () => { return ( -
+
); @@ -338,14 +338,14 @@ export const KpiCard = ({ if (total < trend) { return (
- +{calc}% + +{calc}%
); } return (
- -{calc}% + -{calc}%
); }; @@ -354,15 +354,15 @@ export const KpiCard = ({ +
- {title} -
+ {title} +
{formatTotal(total)}
@@ -797,7 +797,7 @@ import { IOrder, IOrderStatus } from "../../../interfaces"; export const RecentSales = () => { const { - tableQueryResult, + tableQuery, pageCount, current, pageSize, @@ -814,7 +814,7 @@ export const RecentSales = () => { }, }); - const orders = tableQueryResult?.data?.data; + const orders = tableQuery?.data?.data; const formatCurrency = (value: number) => { return value.toLocaleString("en-US", { @@ -867,7 +867,7 @@ export const RecentSales = () => { }; const header = ( -
+
-
+
@@ -1713,8 +1713,8 @@ export const ProductEdit = () => { -
+
+
-
+
@@ -1941,7 +1941,7 @@ export const ProductShow = () => { +
-
+
@@ -2459,8 +2459,8 @@ export const CategoryEdit = () => { -
+
+
-
+
@@ -2536,7 +2536,7 @@ export const CategoryShow = () => { +
} bottomContent={ -
+
{ {column.header} @@ -1911,7 +1911,7 @@ export const ProductCreate = () => { }} />
-
+
-
+
- +

Product details

@@ -2274,13 +2274,13 @@ export const ProductShow = () => { alt={product.name} /> ) : null} -

Name

+

Name

{product?.name}

-

Price

+

Price

{currencyFormatter.format(product?.price ?? 0)}

-

Category

+

Category

{categoryData?.data.title}

-

Description

+

Description

{product?.description}

@@ -2415,7 +2415,7 @@ const columns = [ export const CategoryList = () => { const { - tableQueryResult, + tableQuery, pageCount, current, pageSize, @@ -2438,13 +2438,13 @@ export const CategoryList = () => { direction: "ascending", }); - const categories = tableQueryResult?.data?.data ?? []; + const categories = tableQuery?.data?.data ?? []; const renderCell = useCallback((columnKey: string, item: IProduct) => { if (columnKey === "actions") { return ( -
+
-
+
{
} bottomContent={ -
+
{ {column.header} @@ -2731,7 +2731,7 @@ export const CategoryCreate = () => { }} />
-
+
-
+
- +

Category details

{category?.cover ? ( {category.title} ) : null} -

Id

+

Id

{category?.id ?? 0}

-

Title

+

Title

{category?.title ?? ""}

@@ -2968,16 +2968,16 @@ export const Menu = () => { const { menuItems } = useMenu(); return (