Hey,
I have been trying to update the store of my apollo+react app after a create mutation but am failing miserably. The issue is as follows: I have a component showing a list of items which are fetched using a query named ALL_ITEMS_QUERY. In another component, i have a mutation which creates an item. Both the mutation and the query to fetch seem to work fine in isolation. When i try to read the store in an update() function:
update:(store, {data:{createItem}}) => {
const data=store.readQuery({query: ALL_ITEMS_QUERY})
}
I find that if the ALL_ITEMS_QUERY has no filters, I am able to read the store and things work just fine. However, if the ALL_ITEMS_QUERY has any filters applied to it, I get an error of the form :
Can’t find field allItems({“filter”:{“AND”:[{“type”:{“description”:“XYZ”}},{“thing”:{“ent”:{}}}]}}) on object (ROOT_QUERY)
I cannot seem to find anything in the docs to cover this use case. What am I missing? Can someone please point me in the right direction?