Skip to content

Introduce useMutationWithMutationMode hook#10910

Merged
slax57 merged 13 commits intonextfrom
useMutationWithMutationMode
Sep 9, 2025
Merged

Introduce useMutationWithMutationMode hook#10910
slax57 merged 13 commits intonextfrom
useMutationWithMutationMode

Conversation

@djhi
Copy link
Copy Markdown
Contributor

@djhi djhi commented Sep 2, 2025

Problem

Whenever we introduce a new mutation, we have to re-implement mutationMode handling. We don't always do it the same way.

Solution

Introduce useMutationWithMutationMode hook to make all our mutation hooks consistant.

How To Test

  • All current hooks should work as before
  • Unit tests

Additional Checks

  • The PR targets master for a bugfix or a documentation fix, or next for a feature
  • The PR includes unit tests (if not possible, describe why)
  • The PR includes one or several stories (if not possible, describe why) => The default hooks stories are enough for now
  • The documentation is up to date => We don't want to invest more at this stage

Also, please make sure to read the contributing guidelines.

@djhi djhi added RFR Ready For Review and removed WIP Work In Progress labels Sep 3, 2025
@slax57 slax57 self-requested a review September 8, 2025 08:46
Copy link
Copy Markdown
Contributor

@slax57 slax57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the regression I found, I really like this new organization of the code as it removes many boilerplate and error-prone code from the dataProvider hooks, so kudos for that!! 💪

Comment thread packages/ra-core/src/dataProvider/useDeleteMany.ts Outdated
Comment thread packages/ra-core/src/dataProvider/useUpdate.ts
Comment thread packages/ra-core/src/dataProvider/useUpdateMany.spec.tsx
Comment thread packages/ra-core/src/dataProvider/useUpdateMany.spec.tsx Outdated
Comment thread packages/ra-core/src/dataProvider/useDeleteMany.ts
Comment thread packages/ra-core/src/dataProvider/useMutationWithMutationMode.ts Outdated
Comment thread packages/ra-core/src/dataProvider/useUpdateMany.spec.tsx Outdated
Comment thread packages/ra-core/src/dataProvider/useMutationWithMutationMode.ts
Comment thread packages/ra-core/src/dataProvider/useCreate.ts Outdated
@slax57 slax57 added this to the 5.12.0 milestone Sep 9, 2025
@slax57 slax57 merged commit b346414 into next Sep 9, 2025
2 checks passed
@slax57 slax57 deleted the useMutationWithMutationMode branch September 9, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RFR Ready For Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants