Antd Edit Page Don't send Id area
I updated my refine version and antd. Currently i use 3.99.4 refine version. I use edit page like this and i'm sure "idFromRoute" value is valid. But whenever i press Save button, useForm don't send any id property to my api so my api thinks it is a new entity and i must create them. So, it will be duplicated. How can i manage it?
Normally i can hide a form item which holds value of entity id but i think there is a framework-level solution and if it exist, i want to use this solution, not hidden form item.
7 Replies
rare-sapphire•2y ago
Hey @juncture I did not fully understand the problem. Could you please send a codesandbox that we can reproduce?
Or let's try and check your
useForm
usage and Refine.resources
definitions.flat-fuchsia•2y ago
I share my usages as attachmets
Hey @juncture ,
When in 'edit' mode of 'useForm', you must provide the 'id' information of the record you are editing either through the 'id' parameter or by using 'setId'. Do you have a line of code that does this? If you want to read the 'id' parameter in the URL, you can use the 'useResource' hook.
https://refine.dev/docs/api-reference/antd/hooks/form/useForm/#id
https://refine.dev/docs/api-reference/core/hooks/resource/useResource/#id
flat-fuchsia•2y ago
Is this property added recently? Because i didn't use it earlier. For example, in this version, i didn't use like this and there is no problem with that
This property is not new, but taking it strictly resolves a lot of bugs. So if it is possible for you to provide this property, you can do so
flat-fuchsia•2y ago
I understand it, thanks a lot!
By the way, version 5 of ant-design has been released, if you want to migrate, check out https://refine.dev/docs/api-reference/antd/migration-guide/v4-to-v5/
Migration Guide | refine
Ant Design released a new major version as a v5. This document will help you upgrade from antd 4.x version to antd 5.x version.