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

useMutation drops declaration-time options #6882

Closed
robertjustjones opened this issue Nov 18, 2021 · 2 comments · Fixed by #6886
Closed

useMutation drops declaration-time options #6882

robertjustjones opened this issue Nov 18, 2021 · 2 comments · Fixed by #6886
Labels

Comments

@robertjustjones
Copy link

What you were expecting:

For this code

const [ mutate ] = useMutation( undefined, { returnPromise: true } );

const post = await mutate( { type: 'create', resource: 'posts', data } );
console.log( post.data )

I expected post to be set.

What happened instead:
post was not set after the await because the returnPromise got dropped at callTime.

Steps to reproduce:

Related code:

I believe this this line in useMutation should be like this line

Other information:

Environment

├─ @react-admin/ra-audit-log@2.5.1
├─ @react-admin/ra-editable-datagrid@2.1.1
├─ @react-admin/ra-enterprise@5.1.1
│ ├─ @react-admin/ra-form-layout@1.7.0
│ └─ @react-admin/ra-preferences@1.4.2
├─ @react-admin/ra-form-layout@1.8.0
├─ @react-admin/ra-markdown@1.3.1
├─ @react-admin/ra-navigation@3.0.1
├─ @react-admin/ra-preferences@1.4.3
├─ @react-admin/ra-rbac@1.0.1
├─ @react-admin/ra-realtime@1.4.3
├─ @react-admin/ra-relationships@2.1.10
├─ @react-admin/ra-search@2.2.1
├─ @react-admin/ra-tour@1.2.0
├─ @react-admin/ra-tree@1.6.8
└─ react-admin@3.19.1

@djhi djhi added the bug label Nov 19, 2021
@djhi
Copy link
Collaborator

djhi commented Nov 19, 2021

Thanks for reporting!

@robertjustjones
Copy link
Author

Excellent, thanks!

@fzaninotto fzaninotto removed this from the 3.19.2 milestone Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants