-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix<DeleteButton mutationOptions>
ignores meta
parameter
#8023
Conversation
[skip ci]
packages/ra-core/src/controller/button/useDeleteWithConfirmController.tsx
Outdated
Show resolved
Hide resolved
packages/ra-core/src/controller/button/useDeleteWithUndoController.tsx
Outdated
Show resolved
Hide resolved
packages/ra-ui-materialui/src/button/BulkDeleteWithConfirmButton.tsx
Outdated
Show resolved
Hide resolved
packages/ra-ui-materialui/src/button/BulkDeleteWithUndoButton.tsx
Outdated
Show resolved
Hide resolved
| --------------------| -------- | --------------- | ------------------ | ---------------------------------------------------| | ||
| `label` | Optional | `string` | 'ra.action.delete' | label or translation message to use | | ||
| `icon` | Optional | `ReactElement` | `<DeleteIcon>` | iconElement, e.g. `<CommentIcon />` | | ||
| `mutationOptions` | Optional | `object` | null | options for react-query `useMutation` hook | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description isn't entirely accurate, as react-query's options
cannot contain a meta
key. In fact, you should probably add an example explaining how to set the meta
parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a meta
option in useMutation
. It is of type Record<string, unknown>
when ours is any
though.
@@ -277,6 +277,7 @@ Delete the current record after a confirm dialog has been accepted. To be used i | |||
| `confirmContent` | Optional | `ReactNode` | 'ra.message.delete_content' | Message or React component to be used as the body of the confirm dialog | | |||
| `redirect` | Optional | `string | false | Function` | 'list' | Custom redirection after success side effect | | |||
| `translateOptions` | Optional | `{ id?: string, name?: string }` | {} | Custom id and name to be used in the confirm dialog's title | | |||
| `mutationOptions` | Optional | | null | options for react-query `useMutation` hook | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
Could you add a test to prove that it works? |
Here you are, colleague of little faith. |
packages/ra-core/src/controller/button/useDeleteWithConfirmController.spec.tsx
Outdated
Show resolved
Hide resolved
packages/ra-core/src/controller/button/useDeleteWithUndoController.spec.tsx
Outdated
Show resolved
Hide resolved
packages/ra-core/src/controller/button/useDeleteWithConfirmController.spec.tsx
Outdated
Show resolved
Hide resolved
packages/ra-core/src/controller/button/useDeleteWithConfirmController.spec.tsx
Show resolved
Hide resolved
packages/ra-core/src/controller/button/useDeleteWithUndoController.spec.tsx
Outdated
Show resolved
Hide resolved
meta
<DeleteButton mutationOptions>
cannot include a meta
parameter
<DeleteButton mutationOptions>
cannot include a meta
parameter<DeleteButton mutationOptions>
ignores meta
parameter
Fix #8016
Kudos to @carlos-duran
mutationOptions
on<BulkDeleteWithConfirmButton>
and<BulkDeleteWithUndoButton>
generates an errormutationOptions
prop description on delete buttons documentationuseMutation documentation.