Skip to content
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

TypePolicy seems to be missing keyArgs #9062

Closed
unluckynelson opened this issue Nov 15, 2021 · 1 comment
Closed

TypePolicy seems to be missing keyArgs #9062

unluckynelson opened this issue Nov 15, 2021 · 1 comment

Comments

@unluckynelson
Copy link

unluckynelson commented Nov 15, 2021

export type TypePolicy = {

According to the docs https://www.apollographql.com/docs/react/pagination/core-api/ a Query property should be available on the TypePolicy type but is not

Property 'Query' is incompatible with index signature.

@benjamn
Copy link
Member

benjamn commented Nov 29, 2021

Field policies can have keyArgs, but type policies have keyFields.

Field policies go in the fields subsection of the TypePolicy object:

new InMemoryCache({
  typePolicies: {
    Query: { // Type policy for the Query object
      fields: {
        someField: { // Field policy for the Query.someField field
          keyArgs: [...],
        },
      },
    },
  },
})

More discussion in #8021 (comment) if you're curious why it doesn't make sense to configure keyArgs for an object type.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants