Skip to content
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

[BC Break] Migrate useDelete and useDeleteMany to react query #7035

Merged
merged 15 commits into from
Dec 27, 2021

Conversation

fzaninotto
Copy link
Member

  • Update useDelete and useDeleteMany to use react-query
  • Replace onSuccess and onFailure <DeleteButton> props with mutationOptions
  • Fix tests, docs and examples
  • Add upgrade instructions
// useDelete
-const [deleteOne, { loading }] = useDelete(
-   'posts',
-   123,
-   { id: 123, title: "hello, world", likes: 122 }
-);
-deleteOne(resource, id, previousData, options);
+const [deleteOne, { isLoading }] = useDelete(
+   'posts',
+   {
+       id: 123,
+       previousData: { id: 123, title: "hello, world", likes: 122 }
+   }
+);
+deleteOne(resource, { id, previousData }, options);

// useDeleteMany
-const [deleteMany, { loading }] = useDeleteMany(
-   'posts',
-   [123, 456],
-);
-deleteMany(resource, ids, options);
+const [deleteMany, { isLoading }] = useDeleteMany(
+   'posts',
+   {
+       ids: [123, 456],
+   }
+);
+deleteMany(resource, { ids }, options);

@fzaninotto fzaninotto added the RFR Ready For Review label Dec 25, 2021
@fzaninotto fzaninotto added this to the 4.0.0-alpha.1 milestone Dec 25, 2021
@fzaninotto fzaninotto mentioned this pull request Dec 25, 2021
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.

1 participant