I think someone might've answered this before but ...
# apollo-kotlin
f
I think someone might've answered this before but I can't find it. Does the cache pay attention to
@include
directives? I believe I've run into a case where
if=false
but it's generating a cache miss due to the associated fields being missing.
m
It should, if not it's a bug
It's all done here
f
ok thanks I'll try to find out what's going on
thank you color 1
ok one clue that occurs to me is that our directive is not placed on the problem field itself, but rather on a fragment inclusion e.g.
Copy code
...myFragment @include(if: $includeMyFragment)
and even though
$includeMyFragment
is false, there is a field in that fragment that is causing the cache miss. So now I just need to dig in a bit more and figure out why that fragment is included.
👀 1
m
Interesting. I'm not sure if we have a test for that. If we don't that'd definitely be a good one to have
f
Yeah I think it might need a condition check in CacheBatchReader.collect()
👀 1
m
I'm in the middle of something but will double check in a bit
👍 1
gratitude thank you 1
In the meantime you can put
@include
on individual fields instead. Not perfect but it's a path forward
f
awesome, thank you!
💙 1