flat-fuchsia
flat-fuchsia2mo ago

how to globally set createMutationOptions and updateMutationOptions?

how to globally set createMutationOptions and updateMutationOptions?
2 Replies
kapa.ai
kapa.ai2mo ago
Hi @flankieflew. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To globally set createMutationOptions and updateMutationOptions in refine, you can use the options prop of the <Refine> component. However, based on the provided knowledge sources, there isn't a direct way to set these specific options globally. The closest global configuration option related to mutations is the mutationMode, which can be set in the <Refine> component as shown in this example:
<Refine
...
options={{ mutationMode: "optimistic" }}
/>
<Refine
...
options={{ mutationMode: "optimistic" }}
/>
Mutation Mode Usage (https://refine.dev/docs/advanced-tutorials/mutation-mode/#usage) For createMutationOptions and updateMutationOptions, you typically set these at the hook level when using useForm or similar hooks. For example:
useForm({
createMutationOptions: { retry: 3 },
updateMutationOptions: { retry: 3 },
});
useForm({
createMutationOptions: { retry: 3 },
updateMutationOptions: { retry: 3 },
});
useForm createMutationOptions (https://refine.dev/docs/data/hooks/use-form/#createmutationoptions) useForm updateMutationOptions (https://refine.dev/docs/data/hooks/use-form/#updatemutationoptions) If you want to apply these options consistently across your application, you might consider creating a custom hook that wraps useForm and applies your desired options by default. This way, you can reuse the configuration throughout your app without setting it for each form individually. However, it's important to note that there isn't a built-in way to set these mutation options globally based on the information provided in the knowledge sources. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@343691288442306561> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?