Resource gets created twice when submitting with enter
When I want to create resource, it gets created twice when I submit the antd form with enter. If click on the Save button with mouse, it works as it should - only creating one entity.
2 Replies
Hi @chachi. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. However, it seems like there might be an issue with how the
submitOnEnter
functionality is implemented in your form setup. Based on the knowledge sources, there was a known issue where the submitOnEnter
prop was incorrectly documented to be used inside refineCoreProps
. The correct usage is to pass submitOnEnter
directly to the useForm
hook.
Here's the correct way to use submitOnEnter
:
Make sure you are using this setup in your form. If the issue persists, it might be related to other factors such as component remounting or strict mode in React, which can cause duplicate requests. You might want to check if disabling strict mode resolves the issue temporarily.
For more detailed guidance, you can refer to the documentation on useForm
(https://refine.dev/docs/ui-integrations/ant-design/hooks/use-form/#submitonenter) or consider checking for any updates or related issues in the refine GitHub repository (https://github.com/refinedev/refine/issues).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@95552725294518272> Kapa.ai is still learning and improving, please let me know how I did by reacting below.