-
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 not working when using string array after mutation #9597
Comments
Hey @ddkang! Thanks for your patience 🙏 . Would you be willing to share a bit more info here or create a reproduction of the issue? What does your original query look like? I've used |
+1 |
We're closing this issue now but feel free to ping the maintainers or open a new issue if you still need support. Thank you! |
We're experiencing the same issue. If we pass the query with all variables it works. If we pass a string name for the query with no variables, it does not work and we're met with "Unknown query named ..." This works
This does not work
|
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This issue feels like it was closed and locked a bit prematurely, so I'll reopen for now. @lucidlive appreciate the code snippet. Would you or @ddkang be willing to put together a small reproduction to show the issue? While your code snippet gives us a bit more of a clue, it would still be helpful to see what other things might be at play here. You can use our error template as a starting point. I'll go ahead and reset the clock on this issue. If you can help us out with a reproduction, we'd be happy to take a look at it. Thanks! |
I am suddenly running into a similar or same issue:
There are several additional mentions as a few queries are usually requeried together. But focusing on this one. Refetches are here:
Thing is: This does not happen on the live version (yet). So it may be due to a recent change in @apollo/client. We updated yesterday to 3.7.11. Edit: Edit 2: Edit 3: It seems this happens in dev but not in production. |
@barbalex I'm going to echo @jerelmiller's earlier comment - could you please try to create a minimal reproduction for this? |
I have absolutely no idea how to create a reproduction as this suddenly started happening in a complex app. Plus it only seems to happen in dev mode. Sorry for not answering earlier - I was on vacation. |
Probably it happens in production too but the warn is shown only on dev from apollo-client/src/core/QueryManager.ts Line 867 in 4d19216
|
We're finding this to happen when using
|
Is there a fix for this? Whats the workaround? |
I believe the exact behaviour that @beaucollins described above should already have been solved with Apollo Client somewhere around version 3.8, as we changed the subscription timing in If that problem is still occuring, we really need to see some minimal viable reproduction, or a Replay recording of it happening. |
It appears that the query needs to be mounted in order for this to work. |
All my RN app on this warnings :-) And I agree that issue on mount main query.
|
Intended outcome:
A query specified using a string identifier should be refetched when using
refetchQueries
.Actual outcome:
The query is not refetched and old versions of the query data are used from the cache.
How to reproduce the issue:
One way to reproduce:
Then, if mutation 1 has
refetchQueries
set to['posts']
(or whatever the query is called), it won't actually refetch and returns the error:Versions
System:
OS: Linux 5.4 Linux Mint 20 (Ulyana)
Binaries:
Node: 16.7.0 - ~/.nvm/versions/node/v16.7.0/bin/node
Yarn: 1.22.11 - ~/.nvm/versions/node/v16.7.0/bin/yarn
npm: 7.20.3 - ~/.nvm/versions/node/v16.7.0/bin/npm
Browsers:
Chrome: 100.0.4896.75
Firefox: 99.0
npmPackages:
@apollo/client: ^3.5.10 => 3.5.10
npmGlobalPackages:
apollo: 2.33.6
The text was updated successfully, but these errors were encountered: