Let's say that I have the following query that fetches a list of products.
query ProductList() {
products() {
name
price
stockQuantity
isAvailable @client # This is a local-only field
}
}
Also I have added a type policy for a local-only field at the in-memory cache creation, with a read function:
const cache = new InMemoryCache({
typePolicies: { // Type policy map
Product: {
fields: { // Field policy map for the Product type
isAvailable: { // Field policy for the isAvailable field
read(existing, context) { // The read function for the isAvailable field
// Return value
}
}
}
}
}
});
How can I get the stockQuantity
field of the parent Product object at the isAvailable
read function?