-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refetchQueries causes error if query isn't active #594
Comments
Thanks for reporting this. I don't think we expected that someone would try to update queries that hadn't run yet. I think we need to have some sort of warning, but maybe printing a warning to the console is better than throwing an error. Thoughs @stubailo ? |
I think its a fairly common use case. For example, lets say there is a "profile" page that has a list of all the user's posts, and also a "create post" screen for writing and creating a new post. If the user doesn't visit the profile page first, the "getProfile" query isn't run. But on the "create post" screen, the mutation for creating a new post should update the list of all the users posts with refetchQueries. |
Agreed, this is a common thing that shouldn't error. |
For the use case noted by @HammadJ, we have two additional requirements that seem to be problematic with current
Maybe |
@jesenko you are right with second point. We need to have a support for clearing cache |
@HammadJ Can you check if this bug has been fixed in 0.5.0-1? I think it should be fixed. |
Closing this, since it sounds like this has been fixed with #700. |
I'm getting the Is there a way to tell a I'm using the query name as a string for the
|
Moved to #2143 |
If I use the refetchQueries option on a mutation and pass in a name of a query that hasn't run yet, I get an
APOLLO_MUTATION_ERROR
:This is my mutation:
So for this, the
getOwnLooks
query hasn't been run yet. If I make sure the query has run/exists in the apollo store, I get no error. Note, the mutation itself is successful, it's just that it gives this error when trying to refetchQueries.The text was updated successfully, but these errors were encountered: