-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
Intended outcome:
Query should be sent to the server to receive the missing reference
Actual outcome:
Query not sent to server and I get no data
How to reproduce the issue:
- Create a query that fetches a list of items based on a condition:
items(where: { id: $id }) {
...CoreItemFields
}
This will return [item]
- Create a cache redirect to the query
new InMemoryCache({
typePolicies: {
Query: {
fields: {
items: {
read(_, { args, toReference }) {
if (!!args.where?.id) {
return [toReference({ __typename: "Item", id: args.where.id })];
}
}
}
}
}
}
}
If you run a query that queries items that do not exist in the cache, the read function will run, returning a list of 1 reference as expected.
But since the reference references to something that does not exist in cache, the query should run. But it doesn't.
Versions
System:
OS: macOS 12.0.1
Binaries:
Node: 14.18.1 - ~/.nvm/versions/node/v14.18.1/bin/node
Yarn: 1.22.15 - ~/.yarn/bin/yarn
npm: 6.14.15 - ~/.nvm/versions/node/v14.18.1/bin/npm
Browsers:
Chrome: 95.0.4638.69
Safari: 15.1
npmPackages:
apollo-server-express: ^3.3.0 => 3.4.0
Reactions are currently unavailable