Hello!
Any short term plan to change LazyCacheMap to something that would look if all the fields of the query are in the cache before returning a value?
I am really struggling without it..
(I am using typename/id normalization)
Thanks a lot!
so, you're essentially attempting to deserialize an operation from the cache, but one of the referenced entities does not have all the expected fields, and thus is creating an issue?
I'm not sure where this would happen, except for situations where the cache is broken.
If I am not mistaken, simply by calling a first request with a field abc having subField1 and subField2.
Then a second request with the same field abc having subField3 and subField4.
The result of the second request for me is subFields 1 & 2, but should have been 3 & 4.
I am using NormalizedInMemoryCache with dataIdFromObject: typenameDataIdFromObject.
Thanks!
@SwannLV ohh I see. Yes that that is definitely an issue. We can't really solve it without #471, which will be part of v4 #608, which is now my priority so it _could_ be called a short-term plan
Closing as sub-issue of #471
Good news! Can't wait for that 馃檪
Hey @micimize ! I am sorry but I have found what caused this problem! In fact I don't have any problem now! But there might be a very little bug during the merge of old cache and new cache value.
query queryA {
me {
abc {
id
__typename
user { # cache key: user/2
id
__typename
fieldA
fieldB
}
}
}
}
query queryB {
me {
id
__typename # => user
abc {
id
__typename
user { # resolves the partial user/2 from `queryA` which is incorrect
id
__typename # => user
fieldC
fieldD
}
}
}
}
But if I remove me.__typename, the cache works perfectly well!
Working queryB:
query queryB {
me {
id # it works if __typename is removed !
abc {
id
__typename
user {
id
__typename
fieldC
fieldD
}
}
}
}
@SwannLV what you're doing there is basically a workaround to disable normalization, because it won't flatten result unless there's a __typename + id
Indeed, but if i remove normalization on 'me', normalized cache on 'user' works as expected.