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

Seb Jachec

10/24/2023, 11:05 AM
Hi! I'm a bit puzzled why a field isn't being embedded with the (simplified) definitions below – when I inspect the disk SQL cache using Android Studio's database inspector, I can see two separate rows for the account and primary email records instead of 1 for account as I'd expect. Using Apollo 3.8.2 & response-based codegen. Not sure if I'm fundamentally misunderstanding something here – any pointers?
schema.graphqls
Copy code
type Account {
	uid: ID!
	primaryEmail: Email
	...
}

type Email {
	...
}
extensions.graphqls
Copy code
extend type Account @typePolicy(keyFields: "uid", embeddedFields: "primaryEmail")
m

mbonnin

10/24/2023, 11:09 AM
Mmmm, that should work, let me try quickly
Can you copy paste the 2 rows you're seeing?
(or screenshot if easier?)
s

Seb Jachec

10/24/2023, 11:14 AM
Sure thing!
Copy code
_id;key;record
1;Account:<ID_REMOVED>.primaryEmail;{"emailAddress":"<mailto:a@b.com|a@b.com>"}
11;Account:<ID_REMOVED>;{"__typename":"Account","uid":"<ID_REMOVED>","primaryEmail":"ApolloCacheReference{Account:<ID_REMOVED>.primaryEmail}"}
m

mbonnin

10/24/2023, 11:17 AM
Ah, found it, the
embeddedFields
stuff is only in the
-incubating
artifacts
Pretty sure that's it
s

Seb Jachec

10/24/2023, 11:17 AM
Ahh
m

mbonnin

10/24/2023, 11:18 AM
This is all quite experimental and TBH the ergonomics aren't great at the moment
Out of curiosity, what's your use case for
@embeddedFields
? Is it pagination? Something else?
s

Seb Jachec

10/24/2023, 11:24 AM
This specific case is potentially 'over-optimization' tbh, but elsewhere the use-case would be pagination-related (embed
edges
on a connection response type)
m

mbonnin

10/24/2023, 11:24 AM
Makes sense 👍
s

Seb Jachec

10/24/2023, 11:28 AM
What's the status of the incubating artifacts these days btw?
m

mbonnin

10/24/2023, 11:30 AM
Not great TBH, we've had a bit of feedback but I don't think we reached the point where we can be confident this is the path forward
Also we'd certainly need benchmark
That's probably postponed to post-v4
s

Seb Jachec

10/24/2023, 11:57 AM
I see, thanks for the info