gqless icon indicating copy to clipboard operation
gqless copied to clipboard

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

Open outerlook opened this issue 2 years ago • 0 comments

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

outerlook avatar Jul 23 '21 16:07 outerlook