Skip to content

Mutation creating a new object doesn't trigger a watcher of a list of the same item type #281

@vandadnp

Description

@vandadnp

Hi and thank you for GraphQL and the wonderful Apollo iOS library 👍

Imagine that your server has a list of books which you can query like this:

query {
  books {
    id
    name
  }
}

And then you have a mutation using which you can create a book:

mutation book(name: "MyBook) {
  id
  name
}

Which sends back the created book. We also have set up our cacheKeyForObject property like so:

client.cacheKeyForObject = { [$0["__typename"], $0["id"]] }

We are also retaining our watcher object so we are sure it is not getting deallocated however, the watcher is not getting called telling us that a new book has been inserted and cached.

Could somebody please shed some light as to what we could be missing or if this scenario is even supported?

Thanks very much

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions