Can I use useMutation
to get query fields as well?
#7102
Replies: 1 comment 1 reply
-
Update what? And you can always get a return object/ selection of its fields (i.e. like the results after the mutation has been carried out), if your mutation resolver on the server returns the mutated object (in your example, https://www.apollographql.com/docs/react/performance/optimistic-ui/ Edit: this only works with a single object mutation (i.e. with an id and in Apollo client. I'm assuming that is what you are using). If you are updating multiple objects, you also have to update the cache yourself. Apollo won't do it for you. Scott |
Beta Was this translation helpful? Give feedback.
-
I have an
updateSettings
mutation:I want to update it but I also need
id
& when I useuseUpdateSettingsMutation()
then I can getid
using:So should I use that or do I use query like
useSettingsQuery()
? What do people do generally?I've never used codegen before & this is the 1st time I'm seeing mutation returning query fields as well so confused 🤔
Beta Was this translation helpful? Give feedback.
All reactions