Answer the question
In order to leave comments, you need to log in
How to filter requests to Apollo cache?
Hello,
how to filter data in requests to Apollo cache ?
In the official documentation, they do it like this:
const { todo } = client.readQuery({
query: gql`
query ReadTodo {
todo(id: 5) {
id
text
completed
}
}
`,
});
const { user } = client.readQuery({
query: gql`
query ReadUsers {
users(investmentBankingId: 1) {
name
}
}
`
});
Error: Can't find field users({"investmentBankingId":1}) on object {
"users": [
{
"type": "id",
"generated": true,
"id": "ROOT_QUERY.users.0",
"typename": "User"
},
{
"type": "id",
"generated": true,
"id": "ROOT_QUERY.users.1",
"typename": "User"
},
{
"type": "id",
"generated": true,
"id": "ROOT_QUERY.users.2",
"typename": "User"
}
],
query: gql`
{
users {
name
}
}
`
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question