7 Replies
Hi @florent. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To call
refetch
after a create action in your PointsModal
component, you can utilize the onFinish
function provided by the useForm
hook. This function is called when the form is successfully submitted, and you can use it to trigger the refetch
function.
Here's how you can modify your PointsModal
component to include the refetch
call after the form submission:
In this example, the handleFinish
function is defined to first call onFinish
with the form values and then call refetch
to refresh the data.
For more information on the onFinish
function, you can refer to the useForm documentation (https://refine.dev/docs/packages/react-hook-form/use-form/#onfinish-1).
Additionally, you can find more details on how to refetch data manually in the Frequently Asked Questions (https://refine.dev/docs/guides-concepts/faq/#how-can-i-refetch-data) section of the Refine documentation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------sensitive-blueOP•8mo ago
@kapa.ai
But There is no refetch in onFinish.
Let me check the knowledge base for you. One moment! :books:
----------------------
To ensure that you can call
refetch
after the onFinish
function in your PointsModal
component, you need to make sure that refetch
is available from the useForm
hook. Based on the provided information, it seems like refetch
is not directly available in the onFinish
function. Instead, you should call refetch
after the form submission is completed.
Here's how you can modify your PointsModal
component to include the refetch
call after the form submission:
In this example, the handleFinish
function is defined to first call onFinish
with the form values, then call refetch
to refresh the data, and finally reset the form and close the modal.
For more information on how to refetch data manually, you can refer to the Frequently Asked Questions (https://refine.dev/docs/guides-concepts/faq/#how-can-i-refetch-data) section of the Refine documentation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1184365192482652173> kapa.ai is still learning and improving, please let us know how it did by reacting below
sensitive-blueOP•8mo ago
@kapa.ai why "refineCoreProps redirect: 'list', " is not working?
Let me check the knowledge base for you. One moment! :books:
----------------------
The
refineCoreProps
property, including the redirect
option, should work as expected to control the redirection behavior after a form submission. However, if it's not working, there could be a few reasons for this issue. Here are some potential causes and solutions:
1. Incorrect Property Usage: Ensure that you are using the refineCoreProps
correctly within the useForm
hook. The redirect
property should be set within refineCoreProps
.
2. Version Compatibility: Make sure you are using a compatible version of the @refinedev/core
and @refinedev/react-hook-form
packages. There might be a version mismatch causing the issue.
3. Global Configuration: Check if there is a global configuration in your <Refine>
component that might be overriding the local redirect
setting.
Here is an example of how to correctly set the redirect
property within refineCoreProps
:
If the redirect
property is still not working, you can manually handle the redirection after the form submission as a workaround:
For more detailed information, you can refer to the useForm documentation (https://refine.dev/docs/packages/react-hook-form/use-form/#redirect) and the Refine component options (https://refine.dev/docs/core/refine-component/#redirect).
If you continue to experience issues, consider checking the GitHub issues (https://github.com/refinedev/refine/issues) for any related bugs or updates.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1184365192482652173> kapa.ai is still learning and improving, please let us know how it did by reacting below