Skip to content

Declarative cache doesn't work with unions #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Tracked by #2331
martinbonnin opened this issue Feb 21, 2024 · 0 comments
Open
Tracked by #2331

Declarative cache doesn't work with unions #116

martinbonnin opened this issue Feb 21, 2024 · 0 comments

Comments

@martinbonnin
Copy link
Contributor

Description

Follow up from this slack discussion.

type User @typePolicy(keyFields: "id") {
  id 
  name
}

type UserError {
  code
}

union UserResult = UserError | User

type Query {
  getUser(id: ID!): UserResult
}

The UserResult type doesn't have keyfields and therefore this branch is not taken.

More generally, union result types are awkward to work with the cache. See also apollographql/apollo-kotlin#3827

@BoD BoD transferred this issue from apollographql/apollo-kotlin Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant