From 9be86018b8c998bbc412dfdf6974e3be9aaf1998 Mon Sep 17 00:00:00 2001 From: Alican Erdurmaz Date: Fri, 26 Jul 2024 11:10:39 +0300 Subject: [PATCH] chore: revert examples changes --- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- examples/app-crm-minimal/README.MD | 20 ++++++------ .../layout/account-settings/index.tsx | 6 ++-- .../src/routes/companies/edit/form.tsx | 4 +-- .../src/routes/tasks/edit/index.tsx | 6 ++-- examples/app-crm/src/routes/calendar/edit.tsx | 31 ++++++++++--------- .../components/title-form/title-form.tsx | 6 ++-- .../quotes/components/products-services.tsx | 14 ++++++--- .../quotes/components/show-description.tsx | 4 +-- .../src/routes/scrumboard/sales/edit.tsx | 4 +-- .../routes/scrumboard/sales/finalize-deal.tsx | 12 ++++--- .../src/pages/posts/edit.tsx | 6 ++-- examples/auth-antd/src/pages/posts/edit.tsx | 4 +-- examples/auth-auth0/src/pages/posts/edit.tsx | 4 +-- .../auth-chakra-ui/src/pages/posts/edit.tsx | 6 ++-- .../src/pages/posts/edit.tsx | 4 +-- .../auth-headless/src/pages/posts/edit.tsx | 6 ++-- .../auth-keycloak/src/pages/posts/edit.tsx | 4 +-- .../auth-mantine/src/pages/posts/edit.tsx | 4 +-- .../auth-material-ui/src/pages/posts/edit.tsx | 4 +-- examples/auth-otp/src/pages/posts/edit.tsx | 4 +-- examples/base-antd/src/pages/posts/edit.tsx | 15 ++++----- .../base-chakra-ui/src/pages/posts/edit.tsx | 8 ++--- .../base-headless/src/pages/posts/edit.tsx | 6 ++-- .../base-mantine/src/pages/posts/edit.tsx | 6 ++-- .../base-material-ui/src/pages/posts/edit.tsx | 4 +-- .../src/pages/contacts/edit.tsx | 4 +-- .../src/pages/invoice/edit.tsx | 4 +-- .../blog-material-ui/src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/create.tsx | 4 +-- .../src/pages/posts/edit.tsx | 6 ++-- .../blog-react-dnd/src/pages/posts/edit.tsx | 4 +-- .../src/pages/post/create.tsx | 4 +-- .../src/pages/post/edit.tsx | 4 +-- .../src/pages/categories/edit.tsx | 4 +-- .../src/pages/products/edit.tsx | 6 ++-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/products/edit.tsx | 4 +-- .../src/pages/categories/edit.tsx | 4 +-- .../src/pages/products/edit.tsx | 4 +-- .../src/pages/blog-posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 6 ++-- .../src/pages/posts/edit.tsx | 2 +- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/blog-posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 10 +++--- .../src/pages/categories/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 6 ++-- .../src/pages/categories/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 6 ++-- .../src/pages/posts/create.tsx | 4 +-- .../src/pages/posts/edit.tsx | 6 ++-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../components/store/form/useStoreForm.tsx | 4 +-- .../src/pages/couriers/edit.tsx | 6 ++-- .../components/store/form/useStoreForm.tsx | 4 +-- .../src/pages/couriers/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/create.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/create.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 8 ++--- .../src/pages/posts/edit.tsx | 8 ++--- .../src/pages/posts/create.tsx | 4 +-- .../src/pages/posts/edit.tsx | 2 +- .../src/pages/posts/edit.tsx | 4 +-- .../src/components/editPostDrawer.tsx | 4 +-- .../src/pages/posts/edit.tsx | 2 +- .../src/components/editPostModal.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/components/editPostDrawer.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/components/editPostModal.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 20 +++++++----- .../src/pages/posts/edit.tsx | 6 ++-- .../src/pages/posts/edit.tsx | 6 ++-- .../src/app/blog-posts/edit/[id]/page.tsx | 4 +-- examples/i18n-react/src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../input-custom/src/pages/posts/edit.tsx | 2 +- .../src/pages/posts/edit.tsx | 4 +-- examples/invoicer/src/pages/accounts/edit.tsx | 6 ++-- examples/invoicer/src/pages/clients/edit.tsx | 6 ++-- .../src/pages/posts/edit.tsx | 6 ++-- .../loading-overtime/src/pages/posts/edit.tsx | 4 +-- .../blog-posts/src/pages/blog-posts/edit.tsx | 18 +++++------ .../multi-level-menu/src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/contacts/edit.tsx | 2 +- examples/search/src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 10 +++--- .../src/pages/posts/edit.tsx | 8 ++--- .../src/pages/posts/edit.tsx | 6 ++-- .../src/pages/posts/edit.tsx | 4 +-- .../ProfileBillingAddress.tsx | 4 +-- .../profile/ProfileEmail/ProfileEmail.tsx | 4 +-- .../profile/ProfileName/ProfileName.tsx | 4 +-- .../ProfilePassword/ProfilePassword.tsx | 4 +-- .../profile/ProfilePhone/ProfilePhone.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 2 +- .../src/pages/posts/edit.tsx | 2 +- .../src/pages/posts/edit.tsx | 2 +- .../src/pages/posts/edit.tsx | 2 +- .../theme-antd-demo/src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 6 ++-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/blog-posts/edit.tsx | 4 +-- .../src/pages/blog-posts/edit.tsx | 4 +-- .../src/pages/blog-posts/edit.tsx | 4 +-- .../src/pages/blog-posts/edit.tsx | 2 +- .../src/pages/blog-posts/edit.tsx | 2 +- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 6 ++-- .../src/pages/posts/edit.tsx | 6 ++-- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 2 +- .../src/pages/posts/edit.tsx | 4 +-- .../src/pages/posts/edit.tsx | 4 +-- .../src/routes/video-club/members/edit.tsx | 8 ++--- .../src/pages/posts/edit.tsx | 4 +-- .../with-javascript/src/pages/posts/edit.jsx | 4 +-- .../src/pages/blog-posts/edit.tsx | 4 +-- .../src/app/blog-posts/edit/[id]/page.tsx | 4 +-- .../src/app/blog-posts/edit/[id]/page.tsx | 4 +-- .../src/pages/posts/edit.tsx | 6 ++-- .../src/pages/posts/edit.tsx | 6 ++-- .../app/routes/_protected.posts.edit.$id.tsx | 4 +-- .../app/pages/posts/edit.tsx | 6 ++-- .../app/routes/_protected.posts.edit.$id.tsx | 6 ++-- .../app/pages/posts/edit.tsx | 6 ++-- .../app/routes/_protected.posts.edit.$id.tsx | 6 ++-- examples/with-web3/src/pages/posts/edit.tsx | 4 +-- 148 files changed, 385 insertions(+), 377 deletions(-) diff --git a/examples/access-control-casbin/src/pages/posts/edit.tsx b/examples/access-control-casbin/src/pages/posts/edit.tsx index b2f404477172..a7ac2428084d 100644 --- a/examples/access-control-casbin/src/pages/posts/edit.tsx +++ b/examples/access-control-casbin/src/pages/posts/edit.tsx @@ -9,9 +9,9 @@ import MDEditor from "@uiw/react-md-editor"; import type { IPost, ICategory } from "../../interfaces"; export const PostEdit = () => { - const { formProps, saveButtonProps, query } = useForm(); + const { formProps, saveButtonProps, queryResult } = useForm(); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", defaultValue: postData?.category.id, diff --git a/examples/access-control-cerbos/src/pages/posts/edit.tsx b/examples/access-control-cerbos/src/pages/posts/edit.tsx index b2f404477172..a7ac2428084d 100644 --- a/examples/access-control-cerbos/src/pages/posts/edit.tsx +++ b/examples/access-control-cerbos/src/pages/posts/edit.tsx @@ -9,9 +9,9 @@ import MDEditor from "@uiw/react-md-editor"; import type { IPost, ICategory } from "../../interfaces"; export const PostEdit = () => { - const { formProps, saveButtonProps, query } = useForm(); + const { formProps, saveButtonProps, queryResult } = useForm(); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", defaultValue: postData?.category.id, diff --git a/examples/access-control-permify/src/pages/posts/edit.tsx b/examples/access-control-permify/src/pages/posts/edit.tsx index 7fb8a2adb81d..8d66194f97b3 100644 --- a/examples/access-control-permify/src/pages/posts/edit.tsx +++ b/examples/access-control-permify/src/pages/posts/edit.tsx @@ -9,9 +9,9 @@ import MDEditor from "@uiw/react-md-editor"; import type { IPost, ICategory } from "../../interfaces"; export const PostEdit = () => { - const { formProps, saveButtonProps, query } = useForm(); + const { formProps, saveButtonProps, queryResult } = useForm(); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", defaultValue: postData?.category.id, diff --git a/examples/app-crm-minimal/README.MD b/examples/app-crm-minimal/README.MD index 5e1612f1b599..aeffb9902177 100644 --- a/examples/app-crm-minimal/README.MD +++ b/examples/app-crm-minimal/README.MD @@ -837,10 +837,10 @@ export const AccountSettings = ({ opened, setOpened, userId }: Props) => { * formProps -> It's an instance of HTML form that manages form state and actions like onFinish, onValuesChange, etc. * https://refine.dev/docs/ui-integrations/ant-design/hooks/use-form/#form * - * query -> contains the result of the query. For example, isLoading, data, error, etc. - * https://refine.dev/docs/packages/react-hook-form/use-form/#query + * queryResult -> contains the result of the query. For example, isLoading, data, error, etc. + * https://refine.dev/docs/packages/react-hook-form/use-form/#queryresult */ - const { saveButtonProps, formProps, query } = useForm< + const { saveButtonProps, formProps, queryResult } = useForm< /** * GetFields is used to get the fields of the mutation i.e., in this case, fields are name, email, jobTitle, and phone * https://refine.dev/docs/data/packages/nestjs-query/#getfields @@ -878,14 +878,14 @@ export const AccountSettings = ({ opened, setOpened, userId }: Props) => { gqlMutation: UPDATE_USER_MUTATION, }, }); - const { avatarUrl, name } = query?.data?.data || {}; + const { avatarUrl, name } = queryResult?.data?.data || {}; const closeModal = () => { setOpened(false); }; // if query is processing, show a loading indicator - if (query?.isLoading) { + if (queryResult?.isLoading) { return ( { // create a modal form to edit a task using the useModalForm hook // modalProps -> It's an instance of Modal that manages modal state and actions like onOk, onCancel, etc. // close -> It's a function that closes the modal - // query -> It's an instance of useQuery from react-query - const { modalProps, close, query } = useModalForm({ + // queryResult -> It's an instance of useQuery from react-query + const { modalProps, close, queryResult } = useModalForm({ // specify the action to perform i.e., create or edit action: "edit", // specify whether the modal should be visible by default @@ -1781,10 +1781,10 @@ const TasksEditPage = () => { }, }); - // get the data of the task from the query - const { description, dueDate, users, title } = query?.data?.data ?? {}; + // get the data of the task from the queryResult + const { description, dueDate, users, title } = queryResult?.data?.data ?? {}; - const isLoading = query?.isLoading ?? true; + const isLoading = queryResult?.isLoading ?? true; return ( { - const { saveButtonProps, formProps, query } = useForm< + const { saveButtonProps, formProps, queryResult } = useForm< GetFields, HttpError, GetVariables @@ -35,13 +35,13 @@ export const AccountSettings = ({ opened, setOpened, userId }: Props) => { gqlMutation: UPDATE_USER_MUTATION, }, }); - const { avatarUrl, name } = query?.data?.data || {}; + const { avatarUrl, name } = queryResult?.data?.data || {}; const closeModal = () => { setOpened(false); }; - if (query?.isLoading) { + if (queryResult?.isLoading) { return ( { - const { saveButtonProps, formProps, formLoading, query } = useForm< + const { saveButtonProps, formProps, formLoading, queryResult } = useForm< GetFields, HttpError, GetVariables @@ -35,7 +35,7 @@ export const CompanyForm = () => { gqlMutation: UPDATE_COMPANY_MUTATION, }, }); - const { avatarUrl, name } = query?.data?.data || {}; + const { avatarUrl, name } = queryResult?.data?.data || {}; const { selectProps: selectPropsUsers, queryResult: queryResultUsers } = useSelect>({ diff --git a/examples/app-crm-minimal/src/routes/tasks/edit/index.tsx b/examples/app-crm-minimal/src/routes/tasks/edit/index.tsx index 5a354105dd01..d09239f0e887 100644 --- a/examples/app-crm-minimal/src/routes/tasks/edit/index.tsx +++ b/examples/app-crm-minimal/src/routes/tasks/edit/index.tsx @@ -27,7 +27,7 @@ export const TasksEditPage = () => { const [activeKey, setActiveKey] = useState(); const { list } = useNavigation(); - const { modalProps, close, query } = useModalForm({ + const { modalProps, close, queryResult } = useModalForm({ action: "edit", defaultVisible: true, meta: { @@ -35,8 +35,8 @@ export const TasksEditPage = () => { }, }); - const { description, dueDate, users, title } = query?.data?.data ?? {}; - const isLoading = query?.isLoading ?? true; + const { description, dueDate, users, title } = queryResult?.data?.data ?? {}; + const isLoading = queryResult?.isLoading ?? true; return ( { const { id } = useResource(); const { list } = useNavigation(); - const { formProps, saveButtonProps, form, onFinish, query } = useForm({ - action: "edit", - id, - queryOptions: { - enabled: true, - }, - meta: { - gqlMutation: CALENDAR_UPDATE_EVENT_MUTATION, - }, - }); + const { formProps, saveButtonProps, form, onFinish, queryResult } = + useForm({ + action: "edit", + id, + queryOptions: { + enabled: true, + }, + meta: { + gqlMutation: CALENDAR_UPDATE_EVENT_MUTATION, + }, + }); useEffect(() => { - const startDate = query?.data?.data.startDate; - const endDate = query?.data?.data.endDate; + const startDate = queryResult?.data?.data.startDate; + const endDate = queryResult?.data?.data.endDate; const utcStartDate = dayjs(startDate).utc(); const utcEndDate = dayjs(endDate).utc(); form.setFieldsValue({ - categoryId: query?.data?.data.category.id, - participantIds: query?.data?.data.participants.map( + categoryId: queryResult?.data?.data.category.id, + participantIds: queryResult?.data?.data.participants.map( (participant) => participant.id, ), }); @@ -54,7 +55,7 @@ export const CalendarEditPage: React.FC = () => { time: [utcStartDate, utcEndDate], }); } - }, [query?.data]); + }, [queryResult?.data]); const handleOnFinish = async (values: any) => { const { rangeDate, date, time, color, ...otherValues } = values; diff --git a/examples/app-crm/src/routes/companies/components/title-form/title-form.tsx b/examples/app-crm/src/routes/companies/components/title-form/title-form.tsx index fb5d26eac2ba..a54303e97d85 100644 --- a/examples/app-crm/src/routes/companies/components/title-form/title-form.tsx +++ b/examples/app-crm/src/routes/companies/components/title-form/title-form.tsx @@ -20,7 +20,7 @@ import { COMPANY_TITLE_FORM_MUTATION, COMPANY_TITLE_QUERY } from "./queries"; import styles from "./title-form.module.css"; export const CompanyTitleForm = () => { - const { formProps, query, onFinish } = useForm< + const { formProps, queryResult, onFinish } = useForm< GetFields, HttpError, GetVariables @@ -32,8 +32,8 @@ export const CompanyTitleForm = () => { }, }); - const company = query?.data?.data; - const loading = query?.isLoading; + const company = queryResult?.data?.data; + const loading = queryResult?.isLoading; return (
diff --git a/examples/app-crm/src/routes/quotes/components/products-services.tsx b/examples/app-crm/src/routes/quotes/components/products-services.tsx index 18fef21fc0ce..375c423afb89 100644 --- a/examples/app-crm/src/routes/quotes/components/products-services.tsx +++ b/examples/app-crm/src/routes/quotes/components/products-services.tsx @@ -116,7 +116,7 @@ const columns = [ export const ProductsServices = () => { const params = useParams<{ id: string }>(); - const { formProps, autoSaveProps, query } = useForm< + const { formProps, autoSaveProps, queryResult } = useForm< GetFields, HttpError, GetVariables @@ -149,9 +149,9 @@ export const ProductsServices = () => { }, }); - const { isLoading = false, isFetching = false, refetch } = query ?? {}; + const { isLoading = false, isFetching = false, refetch } = queryResult ?? {}; - const { total, subTotal, items } = query?.data?.data ?? {}; + const { total, subTotal, items } = queryResult?.data?.data ?? {}; return (
{ const params = useParams<{ id: string }>(); - const { formProps, query } = useForm({ + const { formProps, queryResult } = useForm< + Quote, + HttpError, + QuoteUpdateInput + >({ resource: "quotes", action: "edit", id: params.id, @@ -433,7 +437,7 @@ const TaxForm = (props: { }, }); - const formLoading = query?.isLoading ?? false; + const formLoading = queryResult?.isLoading ?? false; if (formLoading) { return ( diff --git a/examples/app-crm/src/routes/quotes/components/show-description.tsx b/examples/app-crm/src/routes/quotes/components/show-description.tsx index 65c2ab91a131..e64ab70739b2 100644 --- a/examples/app-crm/src/routes/quotes/components/show-description.tsx +++ b/examples/app-crm/src/routes/quotes/components/show-description.tsx @@ -15,7 +15,7 @@ const MDEditor = lazy(() => import("@uiw/react-md-editor")); export const ShowDescription = () => { const params = useParams<{ id: string }>(); - const { formProps, query, autoSaveProps } = useForm< + const { formProps, queryResult, autoSaveProps } = useForm< Quote, HttpError, QuoteUpdateInput @@ -35,7 +35,7 @@ export const ShowDescription = () => { }, }); - const formLoading = query?.isLoading ?? false; + const formLoading = queryResult?.isLoading ?? false; return ( diff --git a/examples/app-crm/src/routes/scrumboard/sales/edit.tsx b/examples/app-crm/src/routes/scrumboard/sales/edit.tsx index 3e628e2e2310..26bc644172b0 100644 --- a/examples/app-crm/src/routes/scrumboard/sales/edit.tsx +++ b/examples/app-crm/src/routes/scrumboard/sales/edit.tsx @@ -25,7 +25,7 @@ import { export const SalesEditPage = () => { const { list } = useNavigation(); - const { formProps, modalProps, close, query } = useModalForm< + const { formProps, modalProps, close, queryResult } = useModalForm< GetFields, HttpError, DealUpdateInput @@ -53,7 +53,7 @@ export const SalesEditPage = () => { const { selectProps: userSelectProps, queryResult: userSelectQueryResult } = useUsersSelect(); - const deal = query?.data?.data; + const deal = queryResult?.data?.data; const companyIdField = Form.useWatch("companyId", formProps.form); diff --git a/examples/app-crm/src/routes/scrumboard/sales/finalize-deal.tsx b/examples/app-crm/src/routes/scrumboard/sales/finalize-deal.tsx index cf85e3b553d1..dbb9ffc5d283 100644 --- a/examples/app-crm/src/routes/scrumboard/sales/finalize-deal.tsx +++ b/examples/app-crm/src/routes/scrumboard/sales/finalize-deal.tsx @@ -24,7 +24,7 @@ export const SalesFinalizeDeal = () => { const invalidate = useInvalidate(); const { list } = useNavigation(); - const { formProps, modalProps, close, query } = useModalForm< + const { formProps, modalProps, close, queryResult } = useModalForm< Deal, HttpError, FormValues @@ -48,14 +48,16 @@ export const SalesFinalizeDeal = () => { }); useEffect(() => { - const month = query?.data?.data?.closeDateMonth ?? new Date().getMonth(); - const day = query?.data?.data?.closeDateDay ?? new Date().getDay(); - const year = query?.data?.data?.closeDateYear ?? new Date().getFullYear(); + const month = + queryResult?.data?.data?.closeDateMonth ?? new Date().getMonth(); + const day = queryResult?.data?.data?.closeDateDay ?? new Date().getDay(); + const year = + queryResult?.data?.data?.closeDateYear ?? new Date().getFullYear(); formProps.form?.setFieldsValue({ closeDate: dayjs(new Date(year, month - 1, day)), }); - }, [query?.data?.data]); + }, [queryResult?.data?.data]); return ( { const { resourceName, id } = useResource(); const { - refineCore: { onFinish, formLoading, query }, + refineCore: { onFinish, formLoading, queryResult }, register, handleSubmit, resetField, @@ -19,7 +19,7 @@ export const PostEdit: React.FC = () => { const { options } = useSelect({ resource: "categories", - defaultValue: query?.data?.data.category.id, + defaultValue: queryResult?.data?.data.category.id, }); useEffect(() => { @@ -56,7 +56,7 @@ export const PostEdit: React.FC = () => { {...register("category.id", { required: true, })} - defaultValue={query?.data?.data.category.id} + defaultValue={queryResult?.data?.data.category.id} > {options?.map((category) => (
} diff --git a/examples/blog-refine-shadcn/src/pages/blog-posts/edit.tsx b/examples/blog-refine-shadcn/src/pages/blog-posts/edit.tsx index 40aacfe008c4..42e191a69945 100644 --- a/examples/blog-refine-shadcn/src/pages/blog-posts/edit.tsx +++ b/examples/blog-refine-shadcn/src/pages/blog-posts/edit.tsx @@ -30,7 +30,7 @@ export const BlogPostEdit: React.FC = () => { const { list } = useNavigation(); const { - refineCore: { onFinish, query }, + refineCore: { onFinish, queryResult }, ...form } = useForm({ refineCoreProps: { @@ -47,7 +47,7 @@ export const BlogPostEdit: React.FC = () => { register, setValue, } = form; - const blogPostsData = query?.data?.data; + const blogPostsData = queryResult?.data?.data; const blogPostCategoryData = useOne({ resource: "categories", diff --git a/examples/command-palette-kbar/src/pages/posts/edit.tsx b/examples/command-palette-kbar/src/pages/posts/edit.tsx index 71fb754940bb..541c82f7508c 100644 --- a/examples/command-palette-kbar/src/pages/posts/edit.tsx +++ b/examples/command-palette-kbar/src/pages/posts/edit.tsx @@ -8,11 +8,11 @@ import MDEditor from "@uiw/react-md-editor"; import type { IPost, ICategory } from "../../interfaces"; export const PostEdit = () => { - const { formProps, saveButtonProps, query } = useForm({ + const { formProps, saveButtonProps, queryResult } = useForm({ warnWhenUnsavedChanges: true, }); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", defaultValue: postData?.category.id, diff --git a/examples/customization-login/src/pages/posts/edit.tsx b/examples/customization-login/src/pages/posts/edit.tsx index b2f404477172..a7ac2428084d 100644 --- a/examples/customization-login/src/pages/posts/edit.tsx +++ b/examples/customization-login/src/pages/posts/edit.tsx @@ -9,9 +9,9 @@ import MDEditor from "@uiw/react-md-editor"; import type { IPost, ICategory } from "../../interfaces"; export const PostEdit = () => { - const { formProps, saveButtonProps, query } = useForm(); + const { formProps, saveButtonProps, queryResult } = useForm(); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", defaultValue: postData?.category.id, diff --git a/examples/customization-rtl/src/pages/posts/edit.tsx b/examples/customization-rtl/src/pages/posts/edit.tsx index b2f404477172..a7ac2428084d 100644 --- a/examples/customization-rtl/src/pages/posts/edit.tsx +++ b/examples/customization-rtl/src/pages/posts/edit.tsx @@ -9,9 +9,9 @@ import MDEditor from "@uiw/react-md-editor"; import type { IPost, ICategory } from "../../interfaces"; export const PostEdit = () => { - const { formProps, saveButtonProps, query } = useForm(); + const { formProps, saveButtonProps, queryResult } = useForm(); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", defaultValue: postData?.category.id, diff --git a/examples/customization-theme-antd/src/pages/posts/edit.tsx b/examples/customization-theme-antd/src/pages/posts/edit.tsx index 17b59c3ac153..4951431377df 100644 --- a/examples/customization-theme-antd/src/pages/posts/edit.tsx +++ b/examples/customization-theme-antd/src/pages/posts/edit.tsx @@ -9,9 +9,9 @@ import MDEditor from "@uiw/react-md-editor"; import type { IPost, ICategory } from "../../interfaces"; export const PostEdit = () => { - const { formProps, saveButtonProps, query } = useForm(); + const { formProps, saveButtonProps, queryResult } = useForm(); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", defaultValue: postData?.category.id, diff --git a/examples/customization-theme-chakra-ui/src/pages/posts/edit.tsx b/examples/customization-theme-chakra-ui/src/pages/posts/edit.tsx index 7be6ffeb4421..8d5596c118c3 100644 --- a/examples/customization-theme-chakra-ui/src/pages/posts/edit.tsx +++ b/examples/customization-theme-chakra-ui/src/pages/posts/edit.tsx @@ -14,7 +14,7 @@ import type { IPost } from "../../interfaces"; export const PostEdit = () => { const { - refineCore: { formLoading, query }, + refineCore: { formLoading, queryResult }, saveButtonProps, register, formState: { errors }, @@ -24,8 +24,8 @@ export const PostEdit = () => { const { options } = useSelect({ resource: "categories", - defaultValue: query?.data?.data.category.id, - queryOptions: { enabled: !!query?.data?.data.category.id }, + defaultValue: queryResult?.data?.data.category.id, + queryOptions: { enabled: !!queryResult?.data?.data.category.id }, }); useEffect(() => { diff --git a/examples/customization-theme-mantine/src/pages/posts/edit.tsx b/examples/customization-theme-mantine/src/pages/posts/edit.tsx index b0bd380ba462..e04c3ec36968 100644 --- a/examples/customization-theme-mantine/src/pages/posts/edit.tsx +++ b/examples/customization-theme-mantine/src/pages/posts/edit.tsx @@ -9,7 +9,7 @@ export const PostEdit: React.FC = () => { saveButtonProps, getInputProps, errors, - refineCore: { query: queryResult }, + refineCore: { queryResult }, } = useForm({ initialValues: { title: "", diff --git a/examples/customization-theme-material-ui/src/pages/posts/edit.tsx b/examples/customization-theme-material-ui/src/pages/posts/edit.tsx index 62b6b8d943e4..45452e63c22e 100644 --- a/examples/customization-theme-material-ui/src/pages/posts/edit.tsx +++ b/examples/customization-theme-material-ui/src/pages/posts/edit.tsx @@ -12,7 +12,7 @@ import type { IPost, ICategory, Nullable, IStatus } from "../../interfaces"; export const PostEdit: React.FC = () => { const { saveButtonProps, - refineCore: { query }, + refineCore: { queryResult }, register, control, formState: { errors }, @@ -20,7 +20,7 @@ export const PostEdit: React.FC = () => { const { autocompleteProps } = useAutocomplete({ resource: "categories", - defaultValue: query?.data?.data.category.id, + defaultValue: queryResult?.data?.data.category.id, }); return ( diff --git a/examples/data-provider-airtable/src/pages/blog-posts/edit.tsx b/examples/data-provider-airtable/src/pages/blog-posts/edit.tsx index 01b9df3c4870..6fa814b13d11 100644 --- a/examples/data-provider-airtable/src/pages/blog-posts/edit.tsx +++ b/examples/data-provider-airtable/src/pages/blog-posts/edit.tsx @@ -9,9 +9,9 @@ import MDEditor from "@uiw/react-md-editor"; import type { IPost, ICategory } from "../../interfaces"; export const BlogPostEdit = () => { - const { formProps, saveButtonProps, query } = useForm(); + const { formProps, saveButtonProps, queryResult } = useForm(); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", defaultValue: postData?.category, diff --git a/examples/data-provider-appwrite/src/pages/posts/edit.tsx b/examples/data-provider-appwrite/src/pages/posts/edit.tsx index 8f56be26e339..2e75ea84790d 100644 --- a/examples/data-provider-appwrite/src/pages/posts/edit.tsx +++ b/examples/data-provider-appwrite/src/pages/posts/edit.tsx @@ -12,11 +12,11 @@ import type { IPost, IPostVariables, ICategory } from "../../interfaces"; import { normalizeFile, storage } from "../../utility"; export const PostEdit = () => { - const { - formProps, - saveButtonProps, - query: queryResult, - } = useForm({ + const { formProps, saveButtonProps, queryResult } = useForm< + IPost, + HttpError, + IPostVariables + >({ queryOptions: { select: ({ data }) => { return { diff --git a/examples/data-provider-hasura/src/pages/categories/edit.tsx b/examples/data-provider-hasura/src/pages/categories/edit.tsx index 440c1302dc0a..79803ea61d3b 100644 --- a/examples/data-provider-hasura/src/pages/categories/edit.tsx +++ b/examples/data-provider-hasura/src/pages/categories/edit.tsx @@ -12,7 +12,7 @@ import type { import { CATEGORY_UPDATE_MUTATION } from "./queries"; export const CategoryEdit = () => { - const { formProps, saveButtonProps, query } = useForm< + const { formProps, saveButtonProps, queryResult } = useForm< GetFields, HttpError, GetVariables @@ -28,7 +28,7 @@ export const CategoryEdit = () => { extra: ( <> - query?.refetch()} /> + queryResult?.refetch()} /> ), }} diff --git a/examples/data-provider-hasura/src/pages/posts/edit.tsx b/examples/data-provider-hasura/src/pages/posts/edit.tsx index b524af4c675d..5abb74469f1e 100644 --- a/examples/data-provider-hasura/src/pages/posts/edit.tsx +++ b/examples/data-provider-hasura/src/pages/posts/edit.tsx @@ -26,7 +26,7 @@ import type { import { POST_CATEGORIES_SELECT_QUERY, POST_UPDATE_MUTATION } from "./queries"; export const PostEdit = () => { - const { formProps, saveButtonProps, query, formLoading } = useForm< + const { formProps, saveButtonProps, queryResult, formLoading } = useForm< GetFields, HttpError, GetVariables @@ -36,7 +36,7 @@ export const PostEdit = () => { }, }); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect< GetFieldsFromList >({ @@ -54,7 +54,7 @@ export const PostEdit = () => { extra: ( <> - query?.refetch()} /> + queryResult?.refetch()} /> ), }} diff --git a/examples/data-provider-nestjs-query/src/pages/categories/edit.tsx b/examples/data-provider-nestjs-query/src/pages/categories/edit.tsx index bbbe7bd9b512..8b0af136561b 100644 --- a/examples/data-provider-nestjs-query/src/pages/categories/edit.tsx +++ b/examples/data-provider-nestjs-query/src/pages/categories/edit.tsx @@ -7,7 +7,7 @@ import { CATEGORY_EDIT_MUTATION } from "./queries"; import type { CategoryEditMutation } from "graphql/types"; export const CategoryEdit = () => { - const { formProps, saveButtonProps, query } = useForm< + const { formProps, saveButtonProps, queryResult } = useForm< GetFields >({ metaData: { @@ -21,7 +21,7 @@ export const CategoryEdit = () => { extra: ( <> - query?.refetch()} /> + queryResult?.refetch()} /> ), }} diff --git a/examples/data-provider-nestjs-query/src/pages/posts/edit.tsx b/examples/data-provider-nestjs-query/src/pages/posts/edit.tsx index e4160f8f9ca7..ee44800d9f23 100644 --- a/examples/data-provider-nestjs-query/src/pages/posts/edit.tsx +++ b/examples/data-provider-nestjs-query/src/pages/posts/edit.tsx @@ -15,7 +15,7 @@ import { CATEGORIES_SELECT_QUERY, POST_EDIT_MUTATION } from "./queries"; import type { CategoriesSelectQuery, PostEditMutation } from "graphql/types"; export const PostEdit = () => { - const { formProps, saveButtonProps, query } = useForm< + const { formProps, saveButtonProps, queryResult } = useForm< GetFields, HttpError >({ @@ -39,7 +39,7 @@ export const PostEdit = () => { extra: ( <> - query?.refetch()} /> + queryResult?.refetch()} /> ), }} diff --git a/examples/data-provider-nestjsx-crud/src/pages/posts/edit.tsx b/examples/data-provider-nestjsx-crud/src/pages/posts/edit.tsx index a434918aac6c..31e59050c111 100644 --- a/examples/data-provider-nestjsx-crud/src/pages/posts/edit.tsx +++ b/examples/data-provider-nestjsx-crud/src/pages/posts/edit.tsx @@ -11,10 +11,10 @@ import type { IPost, ICategory, ITags } from "../../interfaces"; import { normalizeFile } from "../../utility/normalize"; export const PostEdit = () => { - const { formProps, saveButtonProps, query } = useForm(); + const { formProps, saveButtonProps, queryResult } = useForm(); const apiUrl = useApiUrl(); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", defaultValue: postData?.category.id, diff --git a/examples/data-provider-strapi-v4/src/pages/posts/edit.tsx b/examples/data-provider-strapi-v4/src/pages/posts/edit.tsx index f0652fe1a217..ee341353a05c 100644 --- a/examples/data-provider-strapi-v4/src/pages/posts/edit.tsx +++ b/examples/data-provider-strapi-v4/src/pages/posts/edit.tsx @@ -8,14 +8,14 @@ import { TOKEN_KEY, API_URL } from "../../constants"; import type { ICategory, IPost } from "../../interfaces"; export const PostEdit: React.FC = () => { - const { formProps, saveButtonProps, query } = useForm({ + const { formProps, saveButtonProps, queryResult } = useForm({ metaData: { populate: ["category", "cover"] }, }); const { selectProps } = useSelect({ resource: "categories", - defaultValue: query?.data?.data?.category?.id, - metaData: { locale: query?.data?.data.locale }, + defaultValue: queryResult?.data?.data?.category?.id, + metaData: { locale: queryResult?.data?.data.locale }, }); return ( diff --git a/examples/data-provider-strapi/src/pages/posts/create.tsx b/examples/data-provider-strapi/src/pages/posts/create.tsx index 57e578303ac2..e3995a5262d5 100644 --- a/examples/data-provider-strapi/src/pages/posts/create.tsx +++ b/examples/data-provider-strapi/src/pages/posts/create.tsx @@ -18,9 +18,9 @@ import { TOKEN_KEY } from "../../constants"; export const PostCreate = () => { const API_URL = useApiUrl(); - const { formProps, saveButtonProps, query } = useForm(); + const { formProps, saveButtonProps, queryResult } = useForm(); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps } = useSelect({ resource: "categories", defaultValue: postData?.category.id, diff --git a/examples/data-provider-supabase/src/pages/posts/edit.tsx b/examples/data-provider-supabase/src/pages/posts/edit.tsx index 3eff2f64e8f3..94b946cf9c7f 100644 --- a/examples/data-provider-supabase/src/pages/posts/edit.tsx +++ b/examples/data-provider-supabase/src/pages/posts/edit.tsx @@ -18,21 +18,21 @@ import { supabaseClient, normalizeFile } from "../../utility"; export const PostEdit = () => { const [isDeprecated, setIsDeprecated] = useState(false); - const { formProps, saveButtonProps, query } = useForm({ + const { formProps, saveButtonProps, queryResult } = useForm({ liveMode: "manual", onLiveEvent: () => { setIsDeprecated(true); }, }); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", defaultValue: postData?.categoryId, }); const handleRefresh = () => { - query?.refetch(); + queryResult?.refetch(); setIsDeprecated(false); }; diff --git a/examples/field-antd-use-select-basic/src/pages/posts/edit.tsx b/examples/field-antd-use-select-basic/src/pages/posts/edit.tsx index 9b0a7c303b23..8be78509a257 100644 --- a/examples/field-antd-use-select-basic/src/pages/posts/edit.tsx +++ b/examples/field-antd-use-select-basic/src/pages/posts/edit.tsx @@ -9,8 +9,8 @@ import MDEditor from "@uiw/react-md-editor"; import type { IPost, ICategory, ITag } from "../../interfaces"; export const PostEdit = () => { - const { formProps, saveButtonProps, query } = useForm(); - const postData = query?.data?.data; + const { formProps, saveButtonProps, queryResult } = useForm(); + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", diff --git a/examples/field-antd-use-select-infinite/src/pages/posts/edit.tsx b/examples/field-antd-use-select-infinite/src/pages/posts/edit.tsx index 9c03ac8e948a..02cabe3559fa 100644 --- a/examples/field-antd-use-select-infinite/src/pages/posts/edit.tsx +++ b/examples/field-antd-use-select-infinite/src/pages/posts/edit.tsx @@ -6,9 +6,9 @@ import MDEditor from "@uiw/react-md-editor"; import type { IPost, ICategory } from "../../interfaces"; export const PostEdit = () => { - const { formProps, saveButtonProps, query } = useForm(); + const { formProps, saveButtonProps, queryResult } = useForm(); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", defaultValue: postData?.category.id, diff --git a/examples/field-material-ui-use-autocomplete/src/pages/posts/edit.tsx b/examples/field-material-ui-use-autocomplete/src/pages/posts/edit.tsx index 58501c149b7a..f630c670e21f 100644 --- a/examples/field-material-ui-use-autocomplete/src/pages/posts/edit.tsx +++ b/examples/field-material-ui-use-autocomplete/src/pages/posts/edit.tsx @@ -18,7 +18,7 @@ import type { export const PostEdit: React.FC = () => { const { saveButtonProps, - refineCore: { formLoading, query }, + refineCore: { formLoading, queryResult }, register, control, formState: { errors }, @@ -27,7 +27,7 @@ export const PostEdit: React.FC = () => { const { autocompleteProps } = useAutocomplete({ resource: "categories", - defaultValue: query?.data?.data.category.id, + defaultValue: queryResult?.data?.data.category.id, }); const { autocompleteProps: tagsAutocompleteProps } = useAutocomplete({ diff --git a/examples/finefoods-antd/src/components/store/form/useStoreForm.tsx b/examples/finefoods-antd/src/components/store/form/useStoreForm.tsx index 94de09d75155..f02c7c98965e 100644 --- a/examples/finefoods-antd/src/components/store/form/useStoreForm.tsx +++ b/examples/finefoods-antd/src/components/store/form/useStoreForm.tsx @@ -25,7 +25,7 @@ export const useStoreForm = (props: Props) => { setIsFormDisabled(true); }, }); - const store = form.query?.data?.data; + const store = form.queryResult?.data?.data; const [latLng, setLatLng] = useState>({ lat: props.action === "create" ? 39.66853 : undefined, @@ -93,7 +93,7 @@ export const useStoreForm = (props: Props) => { setIsFormDisabled(value); }; - const isLoading = form.query?.isFetching || form.formLoading; + const isLoading = form.queryResult?.isFetching || form.formLoading; return { ...form, diff --git a/examples/finefoods-antd/src/pages/couriers/edit.tsx b/examples/finefoods-antd/src/pages/couriers/edit.tsx index 3062ec61fac2..527e9b3142b1 100644 --- a/examples/finefoods-antd/src/pages/couriers/edit.tsx +++ b/examples/finefoods-antd/src/pages/couriers/edit.tsx @@ -49,8 +49,8 @@ export const CourierEdit = () => { const t = useTranslate(); const { list } = useNavigation(); - const { formProps, query, saveButtonProps } = useForm(); - const courier = query?.data?.data; + const { formProps, queryResult, saveButtonProps } = useForm(); + const courier = queryResult?.data?.data; const { selectProps: storeSelectProps } = useSelect({ resource: "stores", @@ -135,7 +135,7 @@ export const CourierEdit = () => { }} > { }, }, }); - const store = form.refineCore.query?.data?.data; + const store = form.refineCore.queryResult?.data?.data; const [latLng, setLatLng] = useState>({ lat: props.action === "create" ? 39.66853 : undefined, @@ -97,7 +97,7 @@ export const useStoreForm = (props: Props) => { }; const isLoading = - form.refineCore?.query?.isFetching || form.refineCore.formLoading; + form.refineCore?.queryResult?.isFetching || form.refineCore.formLoading; return { ...form, diff --git a/examples/finefoods-material-ui/src/pages/couriers/edit.tsx b/examples/finefoods-material-ui/src/pages/couriers/edit.tsx index eb02ed303c5c..06c29bcdb5fd 100644 --- a/examples/finefoods-material-ui/src/pages/couriers/edit.tsx +++ b/examples/finefoods-material-ui/src/pages/couriers/edit.tsx @@ -37,10 +37,10 @@ export const CourierEdit = () => { control, setValue, formState: { errors }, - refineCore: { formLoading, query }, + refineCore: { formLoading, queryResult }, saveButtonProps, } = useForm>(); - const courier = query?.data?.data; + const courier = queryResult?.data?.data; const avatarInput: IFile[] | null = watch("avatar"); const { autocompleteProps: storesAutoCompleteProps } = diff --git a/examples/form-antd-custom-validation/src/pages/posts/edit.tsx b/examples/form-antd-custom-validation/src/pages/posts/edit.tsx index 1887c442d445..b07ed68e9bcd 100644 --- a/examples/form-antd-custom-validation/src/pages/posts/edit.tsx +++ b/examples/form-antd-custom-validation/src/pages/posts/edit.tsx @@ -19,9 +19,9 @@ interface PostUniqueCheckRequestQuery { } export const PostEdit = () => { - const { formProps, saveButtonProps, query } = useForm(); + const { formProps, saveButtonProps, queryResult } = useForm(); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", defaultValue: postData?.category.id, diff --git a/examples/form-antd-mutation-mode/src/pages/posts/create.tsx b/examples/form-antd-mutation-mode/src/pages/posts/create.tsx index 60ced61d9f77..4cd0269cd6b3 100644 --- a/examples/form-antd-mutation-mode/src/pages/posts/create.tsx +++ b/examples/form-antd-mutation-mode/src/pages/posts/create.tsx @@ -9,9 +9,9 @@ import MDEditor from "@uiw/react-md-editor"; import type { IPost, ICategory } from "../../interfaces"; export const PostCreate = () => { - const { formProps, saveButtonProps, query } = useForm(); + const { formProps, saveButtonProps, queryResult } = useForm(); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", diff --git a/examples/form-antd-mutation-mode/src/pages/posts/edit.tsx b/examples/form-antd-mutation-mode/src/pages/posts/edit.tsx index 8b981e2f20d0..3a1b2207f487 100644 --- a/examples/form-antd-mutation-mode/src/pages/posts/edit.tsx +++ b/examples/form-antd-mutation-mode/src/pages/posts/edit.tsx @@ -9,9 +9,9 @@ import MDEditor from "@uiw/react-md-editor"; import type { IPost, ICategory } from "../../interfaces"; export const PostEdit = () => { - const { formProps, saveButtonProps, query } = useForm(); + const { formProps, saveButtonProps, queryResult } = useForm(); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", diff --git a/examples/form-antd-use-form/src/pages/posts/create.tsx b/examples/form-antd-use-form/src/pages/posts/create.tsx index 60ced61d9f77..4cd0269cd6b3 100644 --- a/examples/form-antd-use-form/src/pages/posts/create.tsx +++ b/examples/form-antd-use-form/src/pages/posts/create.tsx @@ -9,9 +9,9 @@ import MDEditor from "@uiw/react-md-editor"; import type { IPost, ICategory } from "../../interfaces"; export const PostCreate = () => { - const { formProps, saveButtonProps, query } = useForm(); + const { formProps, saveButtonProps, queryResult } = useForm(); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", diff --git a/examples/form-antd-use-form/src/pages/posts/edit.tsx b/examples/form-antd-use-form/src/pages/posts/edit.tsx index 8b981e2f20d0..3a1b2207f487 100644 --- a/examples/form-antd-use-form/src/pages/posts/edit.tsx +++ b/examples/form-antd-use-form/src/pages/posts/edit.tsx @@ -9,9 +9,9 @@ import MDEditor from "@uiw/react-md-editor"; import type { IPost, ICategory } from "../../interfaces"; export const PostEdit = () => { - const { formProps, saveButtonProps, query } = useForm(); + const { formProps, saveButtonProps, queryResult } = useForm(); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", diff --git a/examples/form-antd-use-steps-form/src/pages/posts/edit.tsx b/examples/form-antd-use-steps-form/src/pages/posts/edit.tsx index b7767ef85c97..f90ffe845f72 100644 --- a/examples/form-antd-use-steps-form/src/pages/posts/edit.tsx +++ b/examples/form-antd-use-steps-form/src/pages/posts/edit.tsx @@ -15,11 +15,11 @@ export const PostEdit = () => { stepsProps, formProps, saveButtonProps, - query, + queryResult, formLoading, } = useStepsForm(); - const postData = query?.data?.data; + const postData = queryResult?.data?.data; const { selectProps: categorySelectProps } = useSelect({ resource: "categories", defaultValue: postData?.category.id, diff --git a/examples/form-chakra-ui-mutation-mode/src/pages/posts/edit.tsx b/examples/form-chakra-ui-mutation-mode/src/pages/posts/edit.tsx index 520cf6505255..645df021ff63 100644 --- a/examples/form-chakra-ui-mutation-mode/src/pages/posts/edit.tsx +++ b/examples/form-chakra-ui-mutation-mode/src/pages/posts/edit.tsx @@ -14,7 +14,7 @@ import type { IPost } from "../../interfaces"; export const PostEdit = () => { const { - refineCore: { formLoading, query }, + refineCore: { formLoading, queryResult }, saveButtonProps, register, formState: { errors }, @@ -23,12 +23,12 @@ export const PostEdit = () => { const { options } = useSelect({ resource: "categories", - defaultValue: query?.data?.data?.category?.id, - queryOptions: { enabled: !!query?.data?.data?.category?.id }, + defaultValue: queryResult?.data?.data?.category?.id, + queryOptions: { enabled: !!queryResult?.data?.data?.category?.id }, }); useEffect(() => { - setValue("category.id", query?.data?.data?.category?.id || 1); + setValue("category.id", queryResult?.data?.data?.category?.id || 1); }, [options]); return ( diff --git a/examples/form-chakra-ui-use-form/src/pages/posts/edit.tsx b/examples/form-chakra-ui-use-form/src/pages/posts/edit.tsx index c95a0cfeb905..e117e95bdafb 100644 --- a/examples/form-chakra-ui-use-form/src/pages/posts/edit.tsx +++ b/examples/form-chakra-ui-use-form/src/pages/posts/edit.tsx @@ -15,7 +15,7 @@ import type { IPost } from "../../interfaces"; export const PostEdit = () => { const { - refineCore: { formLoading, query }, + refineCore: { formLoading, queryResult }, saveButtonProps, register, formState: { errors }, @@ -24,12 +24,12 @@ export const PostEdit = () => { const { options } = useSelect({ resource: "categories", - defaultValue: query?.data?.data?.category?.id, - queryOptions: { enabled: !!query?.data?.data?.category?.id }, + defaultValue: queryResult?.data?.data?.category?.id, + queryOptions: { enabled: !!queryResult?.data?.data?.category?.id }, }); useEffect(() => { - setValue("category.id", query?.data?.data?.category?.id || 1); + setValue("category.id", queryResult?.data?.data?.category?.id || 1); }, [options]); return ( diff --git a/examples/form-core-use-form/src/pages/posts/create.tsx b/examples/form-core-use-form/src/pages/posts/create.tsx index e2b8ed1792af..9cd56e95c5c0 100644 --- a/examples/form-core-use-form/src/pages/posts/create.tsx +++ b/examples/form-core-use-form/src/pages/posts/create.tsx @@ -5,14 +5,14 @@ import type { IPost } from "../../interfaces"; type FormValues = Omit; export const PostCreate: React.FC = () => { - const { formLoading, onFinish, query } = useForm< + const { formLoading, onFinish, queryResult } = useForm< IPost, HttpError, FormValues >(); // if action is "clone", we'll have defaultValues - const defaultValues = query?.data?.data; + const defaultValues = queryResult?.data?.data; const submit = (event: React.FormEvent) => { event.preventDefault(); diff --git a/examples/form-core-use-form/src/pages/posts/edit.tsx b/examples/form-core-use-form/src/pages/posts/edit.tsx index 5725d19ebd5c..e668618d1a3e 100644 --- a/examples/form-core-use-form/src/pages/posts/edit.tsx +++ b/examples/form-core-use-form/src/pages/posts/edit.tsx @@ -8,7 +8,7 @@ export const PostEdit: React.FC = () => { const { formLoading, onFinish, - query: queryResult, + queryResult, autoSaveProps, onFinishAutoSave, } = useForm({ diff --git a/examples/form-mantine-mutation-mode/src/pages/posts/edit.tsx b/examples/form-mantine-mutation-mode/src/pages/posts/edit.tsx index 8c71270c0f76..0263807ea69f 100644 --- a/examples/form-mantine-mutation-mode/src/pages/posts/edit.tsx +++ b/examples/form-mantine-mutation-mode/src/pages/posts/edit.tsx @@ -9,7 +9,7 @@ export const PostEdit: React.FC = () => { saveButtonProps, getInputProps, errors, - refineCore: { query }, + refineCore: { queryResult }, } = useForm({ initialValues: { title: "", @@ -33,7 +33,7 @@ export const PostEdit: React.FC = () => { const { selectProps } = useSelect({ resource: "categories", - defaultValue: query?.data?.data.category.id, + defaultValue: queryResult?.data?.data.category.id, }); return ( diff --git a/examples/form-mantine-use-drawer-form/src/components/editPostDrawer.tsx b/examples/form-mantine-use-drawer-form/src/components/editPostDrawer.tsx index 94eb1cf89a91..d271107aff3a 100644 --- a/examples/form-mantine-use-drawer-form/src/components/editPostDrawer.tsx +++ b/examples/form-mantine-use-drawer-form/src/components/editPostDrawer.tsx @@ -20,12 +20,12 @@ export const EditPostDrawer: React.FC< getInputProps, errors, modal: { visible, close, title }, - refineCore: { query }, + refineCore: { queryResult }, saveButtonProps, }) => { const { selectProps } = useSelect({ resource: "categories", - defaultValue: query?.data?.data.category.id, + defaultValue: queryResult?.data?.data.category.id, }); return ( diff --git a/examples/form-mantine-use-form/src/pages/posts/edit.tsx b/examples/form-mantine-use-form/src/pages/posts/edit.tsx index 87aa5c334e4c..0263807ea69f 100644 --- a/examples/form-mantine-use-form/src/pages/posts/edit.tsx +++ b/examples/form-mantine-use-form/src/pages/posts/edit.tsx @@ -9,7 +9,7 @@ export const PostEdit: React.FC = () => { saveButtonProps, getInputProps, errors, - refineCore: { query: queryResult }, + refineCore: { queryResult }, } = useForm({ initialValues: { title: "", diff --git a/examples/form-mantine-use-modal-form/src/components/editPostModal.tsx b/examples/form-mantine-use-modal-form/src/components/editPostModal.tsx index aaef94ee41d0..108749328211 100644 --- a/examples/form-mantine-use-modal-form/src/components/editPostModal.tsx +++ b/examples/form-mantine-use-modal-form/src/components/editPostModal.tsx @@ -20,12 +20,12 @@ export const EditPostModal: React.FC< getInputProps, errors, modal: { visible, close, title }, - refineCore: { query }, + refineCore: { queryResult }, saveButtonProps, }) => { const { selectProps } = useSelect({ resource: "categories", - defaultValue: query?.data?.data.category.id, + defaultValue: queryResult?.data?.data.category.id, }); return ( diff --git a/examples/form-material-ui-mutation-mode/src/pages/posts/edit.tsx b/examples/form-material-ui-mutation-mode/src/pages/posts/edit.tsx index 8a9d9747f494..f81bbe02c056 100644 --- a/examples/form-material-ui-mutation-mode/src/pages/posts/edit.tsx +++ b/examples/form-material-ui-mutation-mode/src/pages/posts/edit.tsx @@ -12,7 +12,7 @@ import type { ICategory, IPost, IStatus, Nullable } from "../../interfaces"; export const PostEdit: React.FC = () => { const { saveButtonProps, - refineCore: { query }, + refineCore: { queryResult }, register, control, formState: { errors }, @@ -20,7 +20,7 @@ export const PostEdit: React.FC = () => { const { autocompleteProps } = useAutocomplete({ resource: "categories", - defaultValue: query?.data?.data.category.id, + defaultValue: queryResult?.data?.data.category.id, }); return ( diff --git a/examples/form-material-ui-use-drawer-form/src/components/editPostDrawer.tsx b/examples/form-material-ui-use-drawer-form/src/components/editPostDrawer.tsx index 50e4c8920ea9..d80433c7b1a3 100644 --- a/examples/form-material-ui-use-drawer-form/src/components/editPostDrawer.tsx +++ b/examples/form-material-ui-use-drawer-form/src/components/editPostDrawer.tsx @@ -15,7 +15,7 @@ export const EditPostDrawer: React.FC< UseModalFormReturnType> > = ({ saveButtonProps, - refineCore: { query }, + refineCore: { queryResult }, modal: { visible, close }, register, control, @@ -23,7 +23,7 @@ export const EditPostDrawer: React.FC< }) => { const { autocompleteProps } = useAutocomplete({ resource: "categories", - defaultValue: query?.data?.data.category.id, + defaultValue: queryResult?.data?.data.category.id, }); return ( diff --git a/examples/form-material-ui-use-form/src/pages/posts/edit.tsx b/examples/form-material-ui-use-form/src/pages/posts/edit.tsx index 8a9d9747f494..f81bbe02c056 100644 --- a/examples/form-material-ui-use-form/src/pages/posts/edit.tsx +++ b/examples/form-material-ui-use-form/src/pages/posts/edit.tsx @@ -12,7 +12,7 @@ import type { ICategory, IPost, IStatus, Nullable } from "../../interfaces"; export const PostEdit: React.FC = () => { const { saveButtonProps, - refineCore: { query }, + refineCore: { queryResult }, register, control, formState: { errors }, @@ -20,7 +20,7 @@ export const PostEdit: React.FC = () => { const { autocompleteProps } = useAutocomplete({ resource: "categories", - defaultValue: query?.data?.data.category.id, + defaultValue: queryResult?.data?.data.category.id, }); return ( diff --git a/examples/form-material-ui-use-modal-form/src/components/editPostModal.tsx b/examples/form-material-ui-use-modal-form/src/components/editPostModal.tsx index 7b236962ac19..bd6a0c9c4a96 100644 --- a/examples/form-material-ui-use-modal-form/src/components/editPostModal.tsx +++ b/examples/form-material-ui-use-modal-form/src/components/editPostModal.tsx @@ -20,7 +20,7 @@ export const EditPostModal: React.FC< UseModalFormReturnType> > = ({ saveButtonProps, - refineCore: { query }, + refineCore: { queryResult }, modal: { visible, close, title }, register, control, @@ -28,7 +28,7 @@ export const EditPostModal: React.FC< }) => { const { autocompleteProps } = useAutocomplete({ resource: "categories", - defaultValue: query?.data?.data.category.id, + defaultValue: queryResult?.data?.data.category.id, }); return ( diff --git a/examples/form-material-ui-use-steps-form/src/pages/posts/edit.tsx b/examples/form-material-ui-use-steps-form/src/pages/posts/edit.tsx index 26ac32715b0f..745bb59c6046 100644 --- a/examples/form-material-ui-use-steps-form/src/pages/posts/edit.tsx +++ b/examples/form-material-ui-use-steps-form/src/pages/posts/edit.tsx @@ -26,7 +26,7 @@ const stepTitles = [ export const PostEdit: React.FC = () => { const { saveButtonProps, - refineCore: { formLoading, query, onFinish }, + refineCore: { formLoading, queryResult, onFinish }, register, handleSubmit, control, @@ -39,7 +39,7 @@ export const PostEdit: React.FC = () => { const { autocompleteProps } = useAutocomplete({ resource: "categories", - defaultValue: query?.data?.data.category.id, + defaultValue: queryResult?.data?.data.category.id, }); const renderFormByStep = (step: number) => { diff --git a/examples/form-react-hook-form-use-form/src/pages/posts/edit.tsx b/examples/form-react-hook-form-use-form/src/pages/posts/edit.tsx index 9c2356807d3e..31c133191a13 100644 --- a/examples/form-react-hook-form-use-form/src/pages/posts/edit.tsx +++ b/examples/form-react-hook-form-use-form/src/pages/posts/edit.tsx @@ -5,7 +5,7 @@ import { useBack, useSelect } from "@refinedev/core"; export const PostEdit: React.FC = () => { const back = useBack(); const { - refineCore: { onFinish, formLoading, query }, + refineCore: { onFinish, formLoading, queryResult }, register, handleSubmit, formState: { errors }, @@ -15,15 +15,15 @@ export const PostEdit: React.FC = () => { const { options } = useSelect({ resource: "categories", - defaultValue: query?.data?.data?.category?.id, + defaultValue: queryResult?.data?.data?.category?.id, queryOptions: { - enabled: !!query?.data?.data?.category?.id, + enabled: !!queryResult?.data?.data?.category?.id, }, }); useEffect(() => { - setValue("category.id", query?.data?.data?.category?.id); - }, [query?.data]); + setValue("category.id", queryResult?.data?.data?.category?.id); + }, [queryResult?.data]); return ( @@ -44,7 +44,7 @@ export const PostEdit: React.FC = () => { {...register("category.id", { required: true, })} - defaultValue={query?.data?.data.category.id} + defaultValue={queryResult?.data?.data.category.id} > {options?.map((category) => (