How to change the mutation call when the user clicks confirm?
How to change the mutation call when the user click: Deletar?
By default, it is set to "deleteFacetInput," but I would like it to be "deleteFacet"
6 Replies
Hey @liliapaula! I'm the kapa.ai support bot. I've searched through the docs to try to answer your question. :wave:
----------------------
It is not possible to change the mutation call when the user clicks confirm. The
DeleteButton
component from the @pankod/refine-mantine
package uses the mutationMode
prop to determine which mode the mutation runs with. The available modes are pessimistic
, optimistic
, and undoable
. You can refer to the mutation mode documentation (https://refine.dev/docs/advanced-tutorials/mutation-mode/) for more information.
Here is an example of how to use the mutationMode
prop:
----------------------Mutation Mode | refine
Overview
Did kapa.ai help answer your question?
<@608110667240701962> kapa.ai is still learning and improving, please let us how it did by reacting with a :thumbsup: or :thumbsdown:
afraid-scarlet•2y ago
code:
<DeleteButton
hideText
size="small"
recordItemId={record.id}
mutationMode="pessimistic"
confirmOkText="Deletar"
resourceNameOrRouteName="facet"
confirmCancelText="Cancelar"
confirmTitle="Excluir Etiqueta?"
onSuccess={(value) => {
console.log(value);
}}
/>
passive-yellow•2y ago
Hello @liliapaula, I think you are using GraphQL Provider, if that's the case, it uses camelCase version of the resource and adds delete to the end:
https://github.com/refinedev/refine/blob/next/packages/graphql/src/dataProvider/index.ts#L288
GitHub
refine/index.ts at next · refinedev/refine
Build your React-based CRUD applications, without constraints. - refine/index.ts at next · refinedev/refine
passive-yellow•2y ago
IF you want to change this behaviour, you can pass
metadata.operationName
, and it will be used instead