0

I have a graphql object that has a bunch of nested object fields like the following:

object{
    field1
    field2
    field3
    field4 {
        field4.1
        field4.2 {
            field4.2.1
        }
    }
    field5 {
        field5.1{
            field 5.1.1
            field 5.1.2

        }
    }
    field 6
    field 7
}

The issue is that for field4 and field5 there is no unique identifier for them and they are always unique to the object. I don't want it to try to cache these objects and instead just cache the whole object since the child fields are unique to the parent object.

How do I tell me client that I dont want to try and cache these child fields and instead just cache the object as a whole?

Marco Daniel
  • 5,467
  • 5
  • 28
  • 36
Wonger
  • 285
  • 6
  • 18

1 Answers1

0

I did the following to get around this

const blackList = new Set()
new InMemoryCache({
  dataIdFromObject: (o: any) => {
    if (o.__typename != null) {
       if (cacheBlacklist.has(o.__typename)) {
          return null
        }
        ...
    }
Wonger
  • 285
  • 6
  • 18