I need to find out if Apollo has data cached before trying to call a query for that data from the cache.
This code throws the "Invariant Violation: Can't find field ...... on object"
error if we haven't already called the USER_QUERY. However I don't have a way to check if we've ever called it.
const cachedData = client.readQuery({
query: USER_QUERY,
variables: queryVariables,
});
My problem is I don't know how to check if we've cached data or not before calling any cache.