-
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
Apollo Mocked Provider Warning on refetch #8900
Comments
We're also seeing this. It doesn't seem to negatively impact anything as far as I can tell, but it's a bit noisy to see in the test output. Our prior expectation regarding We have a number of reusable components that use it this way so the fact that the query is not active is not really a concern to us... we just want it to refetch the query if active, and otherwise just do nothing. Is there some way to just disable the console.warn here? |
You avoid this warnings in tests with this function:
|
@salvadortorrubiaNexplore that's not really a good solution IMO This warning is driving me crazy and polluting our test output with thousands of rows... (the whole document node get's printed). @benjamn Is there anyway to solve this? Best way would be to turn this off for the MockedProvider IMO |
@trevordammon did you try to change the refetchQuery of your mutation to this?
|
We found a workaround for this by mocking the
|
@theBrianCui that's already a more elegant solution, but still not great IMO @benjamn any input how this can be solved better? I'm open to contributing but would like some direction on how to fix this |
You can also create your own I ran into this (harmless but annoying!) issue and we already had a specialized hook that wrapped |
These warnings seem to have been introduced in version |
@vinigaviraghi worth mentioning that for this to work you must supply all the variables you require for the query, if the query takes any:
|
Is there a better solution to this yet? Seems like there should be a way to just disable that warning. |
I was able to fix this by editing the refetchQuery. Switched to using the refetchQuery which is new in ApolloClient 3.4 Adding Active, has gotten ridden of my console warns and my application works as expected re-fetching the queries again. |
The problem is still here. Is there some kind of solution in development? This is clearly a bug |
Still seeing this in the latest version |
It there any update on this? I would prefer to avoid passing variables again. |
Still seeing this. Even if I add a mock for the query needed to be refetched this happens. Clearly a bug. Would be nice if this could be addressed +1 |
I have seen a few other posts regarding fetching and MockedProvider. However I haven't seen anyone that is getting the same warning as me.
My code executes a mutation which that uses a refetch to query for data.
The code functions properly.
I am writing tests which mock
add_emergency_contact
and therefore invoke the refetch.I pass in the mocks that I will be using (
getPerson
is the mocked query that should be called in the refetch).My MockedProvider uses newData rather than result. I've tried using both and I haven't noticed a difference.
I left the commented out code so you code see what I have attempted.
Now my tests all seem to pass however I am getting a warning when I run my tests. This warning has the same structure as my
GET_PERSON_QUERY
orgetPerson
mock.The text was updated successfully, but these errors were encountered: