Hi! I'm a bit puzzled why a field isn't being embe...
# apollo-kotlin
s
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
Mmmm, that should work, let me try quickly
Can you copy paste the 2 rows you're seeing?
(or screenshot if easier?)
s
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
Ah, found it, the
embeddedFields
stuff is only in the
-incubating
artifacts
Pretty sure that's it
s
Ahh
m
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
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
Makes sense 👍
s
What's the status of the incubating artifacts these days btw?
m
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
I see, thanks for the info