Skip to content

Should be an way of not updating "immutable" fields of a data, but replacing with new one #238

@outerlook

Description

@outerlook

Consider a schema:

  chat {
    id
    lastMessage {
      id
      content
    }
    allMessages {
      id
      content
    }
  }

Where lastMessage should be exhibited on an "Chat list" and allMessages on the open chat.

If I try to call refetch(() => chat.lastMessage.content) not only the last message cache will be mutated, but also the message on allMessages that previously was the lastMessage.

That is because (I think) there is no means to configure how should a new data be interpreted as new object or modification of an old object. But I guess the configured identifier could be used to handle this, right? If new object, don't mutate but create new object in place...

I don't have a reproduction right now, but tell me if you want me to build some for it or is it already handled somehow and the error is on my part.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions