flat-fuchsia
flat-fuchsia2y ago

deleting successfully but showing error

error notification on settled
17 Replies
dirty-apricot
dirty-apricot2y ago
Hi rehan, i will try to reproduce the issue Did you use 'useDelete' ? Can u share with us more information about your implementation
flat-fuchsia
flat-fuchsia2y ago
import { Button, Table, useTable } from "@pankod/refine-antd"; import { useDelete, useNavigation } from "@pankod/refine-core"; import React from "react"; interface user_Info { name: string; id: string; job: any; } export const List1: React.FC = () => { const { tableProps } = useTable<user_Info>({ resource: "user_info", metaData: { fields: ["id", "name", { job: ["id", "job_name"] }], }, }); const { create } = useNavigation(); const { mutateAsync } = useDelete(); console.log(tableProps); return ( <> <Button onClick={() => create("user_info")}>Create</Button> <Table {...tableProps} rowKey="id"> <Table.Column title="Name" dataIndex={"name"} /> <Table.Column title="Job Name" dataIndex={["job", "job_name"]} /> <Table.Column title="Edit" render={(val, record: any) => { console.log(record); return ( <> <Button onClick={() => mutateAsync( { resource: "job", id: record?.job?.id, }, { onSuccess() { mutateAsync({ resource: "user_info", id: record?.id, }); }, } ) } > Delete </Button> </> ); }} /> </Table> </> ); }; export default List1;
dirty-apricot
dirty-apricot2y ago
what is your installed refine packages version ? you can run npx refine whoami if your refine CLI installed,
if not; https://refine.dev/docs/packages/documentation/cli/#how-to-add-to-an-existing-project
flat-fuchsia
flat-fuchsia2y ago
"@pankod/refine-antd": "^4.1.1", "@pankod/refine-cli": "^1.13.4", "@pankod/refine-core": "^3.18.0", "@pankod/refine-hasura": "^4.7.0", "@pankod/refine-inferencer": "^1.2.0", "@pankod/refine-react-router-v6": "^3.18.0", "@testing-library/jest-dom": "^5.12.0", "@testing-library/react": "^11.2.6", "@testing-library/user-event": "^12.8.3", "@types/jest": "^26.0.23", "graphql": "^15.6.1", "graphql-request": "^3.5.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-scripts": "^5.0.0", "web-vitals": "^1.1.1" Refine Packages: - @pankod/refine-antd: 4.5.0 - @pankod/refine-cli: 1.13.4 - @pankod/refine-core: 3.90.6 - @pankod/refine-hasura: 4.17.3 - @pankod/refine-inferencer: 1.6.0 - @pankod/refine-react-router-v6: 3.38.0
dirty-apricot
dirty-apricot2y ago
thanks 🙏 i will investigate and inform you as soon as possible
flat-fuchsia
flat-fuchsia2y ago
consider u have nested table with object relationship is there a way to update child table from parents table import { Button, Col, Form, Input, Row, Table, useForm, useTable, } from "@pankod/refine-antd"; import { useDelete } from "@pankod/refine-core"; import React from "react"; interface user_Info { name: string; id: string; job: { job_name: string }; } export const UserCreate: React.FC = () => { const { formProps, saveButtonProps } = useForm<user_Info>({ action: "create", resource: "user_info", }); return ( <> <Form {...formProps}> <Row> <Col span={8}> <Form.Item name="name"> <Input placeholder="user Name"></Input> </Form.Item> <Form.Item name={["job", "job_name"]}> <Input placeholder="job Name"></Input> </Form.Item> </Col> </Row> <Button {...saveButtonProps}>save</Button> </Form> </> ); }; export default UserCreate;
flat-fuchsia
flat-fuchsia2y ago
this error am getting
No description
flat-fuchsia
flat-fuchsia2y ago
but i am able to access job_name in useTable so here job table is nested inside user_info table @alicanerdurmaz can u help me with this
dirty-apricot
dirty-apricot2y ago
i will look in to it as soon as possible
flat-fuchsia
flat-fuchsia2y ago
ok did u able to get into this issue?
dirty-apricot
dirty-apricot2y ago
you can try this. it will send requests in order
onClick={async () => {
await mutateAsync({
resource: "job",
id: record?.job?.id,
});
await mutateAsync({
resource: "user_info",
id: record?.id,
});
onClick={async () => {
await mutateAsync({
resource: "job",
id: record?.job?.id,
});
await mutateAsync({
resource: "user_info",
id: record?.id,
});
your code seems fine to me. is this error came from API ? it seems hasura couldn't find job in user_info_insert_input can u please double check field names? because your react code seems ok to mee
flat-fuchsia
flat-fuchsia2y ago
yeah user_info { id name job { job_name } } } its working in hasura https://cloud.hasura.io/project/47f12acd-fc1d-4718-9e3f-0e1ef59b52b8/console
dirty-apricot
dirty-apricot2y ago
sorry but i couldn't open this There was a problem accessing your project We're sorry for the inconvenience, please try refreshing your project. If the problem persists, please contact support.
flat-fuchsia
flat-fuchsia2y ago
can u please create me a sample of refine with hasura for nested tables with object relationship very basic one
dirty-apricot
dirty-apricot2y ago
i will try on monday
flat-fuchsia
flat-fuchsia2y ago
mutation MyMutation { insert_user_info_one(object: {name: "syedddd", job: {data: {job_name: "abcddd"}}, date_of_birth: "2-2-2020"}) { name job { job_name } } } in hasura console this is working this is refines payload object : {name: "jhjhb", date_of_birth: "2022-12-02T11:33:58.134Z", job: {job_name: "jkbjnb"}}
dirty-apricot
dirty-apricot2y ago
Can you Share error plase ?