https://kotlinlang.org logo
#apollo-kotlin
Title
# apollo-kotlin
f

Frank Sullivan

10/10/2023, 10:34 PM
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

mbonnin

10/11/2023, 7:57 AM
It should, if not it's a bug
It's all done here
f

Frank Sullivan

10/11/2023, 2:23 PM
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

mbonnin

10/11/2023, 3:41 PM
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

Frank Sullivan

10/11/2023, 4:02 PM
Yeah I think it might need a condition check in CacheBatchReader.collect()
👀 1
m

mbonnin

10/11/2023, 4:08 PM
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

Frank Sullivan

10/11/2023, 5:55 PM
awesome, thank you!
💙 1
4 Views