# How to use @defer in Apollo GraphQL mutations

**URL:** <https://community.apollographql.com/t/how-to-use-defer-in-apollo-graphql-mutations/8938>\
**Category:** Schema Design\
**Tags:** client, web\
**Created:** [April 17, 2025, 12:02am UTC](https://community.apollographql.com/t/how-to-use-defer-in-apollo-graphql-mutations/8938 "2025-04-17T00:02:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Varun\_Bezzam](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/varun_bezzam/32/5999_2.png) [@Varun\_Bezzam](https://community.apollographql.com/u/Varun_Bezzam)\
**Post date:** [April 17, 2025, 12:03am UTC](https://community.apollographql.com/t/how-to-use-defer-in-apollo-graphql-mutations/8938/1 "2025-04-17T00:03:00Z")

</div>

Hi! I have a Strawberry GraphQL server that supports sending deferred responses to my Apollo client-based frontend, and queries with deferred fields are working as expected. From [this relevant PR](https://github.com/apollographql/apollo-client/pull/10368) and reading the latest code on [master](https://github.com/apollographql/apollo-client/blob/master/src/core/QueryManager.ts), it seems like mutations currently do not really support deferred fields but the Apollo cache is updated correctly for the initial response of a deferred field and then updated again for each subsequent response. Is there any way to use this information to update my frontend without having to rely on the `data ` returned by the mutation?

Sample Mutation:

```auto
mutation CreateObject($params: [Param!]) {
  createObject(params: $params) {
    id
    ... @defer {
         data
    }
  }
}

```

What is the recommended way to update my frontend with this newly created object so that I don’t have to wait for the full response from the backend?

---

<div class="post-metadata">

**Author:** ![lenz](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/lenz/32/4007_2.png) [@lenz](https://community.apollographql.com/u/lenz)\
**Post date:** [April 17, 2025, 7:55am UTC](https://community.apollographql.com/t/how-to-use-defer-in-apollo-graphql-mutations/8938/2 "2025-04-17T07:55:22Z")

</div>

Hi @Varun_Bezzam,

you’re right in your analysis - as `mutate` returns a promise and `useMutation` relies on that API, we have no way (without changing our apis) of exposing more than one value here - and that will be the last one.

If you know the `id` of the object being created, you could use `useFragment` to get to that value early.

Apart from that, all solutions I can think of are inherently hacky: You could use a `write` `TypePolicy` to track on the side what’s written to the cache, or you could use a custom link to observe incoming values - but nothing straightforward for your use case, I’m sorry.

---

<div class="post-metadata">

**Author:** ![Varun\_Bezzam](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/varun_bezzam/32/5999_2.png) [@Varun\_Bezzam](https://community.apollographql.com/u/Varun_Bezzam)\
**Post date:** [April 17, 2025, 4:41pm UTC](https://community.apollographql.com/t/how-to-use-defer-in-apollo-graphql-mutations/8938/3 "2025-04-17T16:41:57Z")

</div>

Hi @lenz! Thank you for your response, much appreciated! Is there any timeline/planned work for general support for @defer on mutations?

---

<div class="post-metadata">

**Author:** ![lenz](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/lenz/32/4007_2.png) [@lenz](https://community.apollographql.com/u/lenz)\
**Post date:** [April 22, 2025, 9:56am UTC](https://community.apollographql.com/t/how-to-use-defer-in-apollo-graphql-mutations/8938/4 "2025-04-22T09:56:54Z")

</div>

Not as far as I’m aware this point.  
As I said, it would require changing the user-facing API, which is quite interruptive to our userbase, and the main idea of a mutation is to invoke a side effect on the server.

Most of our users don’t manually update the cache after a mutation based on the mutation result, but use either passive cache updates from the mutation result or `refetchQueries` to update their UI after a mutation.  
I have to admit that I believe you’re the first person that ever brought it up with us that they wanted to access deferred results from a mutation early (apart from the passive cache updates).

We can consider it in the future, but there are no immediate plans.

---

<div class="post-metadata">

**Author:** ![Varun\_Bezzam](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/varun_bezzam/32/5999_2.png) [@Varun\_Bezzam](https://community.apollographql.com/u/Varun_Bezzam)\
**Post date:** [April 24, 2025, 8:09pm UTC](https://community.apollographql.com/t/how-to-use-defer-in-apollo-graphql-mutations/8938/5 "2025-04-24T20:09:28Z")

</div>

Sounds good, thank you for your response.
