-
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 local state: no re-render after resolver resolves with useQuery since 3.0.0-rc.0 #6393
Comments
I think this could be a duplicate of #6392 |
So I did the only sane thing left and decided to use $ git bisect start v3.0.0-rc.0 v3.0.0-beta.54
Bisecting: 4 revisions left to test after this (roughly 2 steps)
[045a0afa587e7697fe2ded7967614cf2e700a858] Fix typo in react/hoc.mdx (#6223)
$ npm run build
$ git bisect good
Bisecting: 2 revisions left to test after this (roughly 1 step)
[e572f4ce36c2729f9fc31a66b7439c6d9f7684fe] Allow setting new ApolloLink after ApolloClient instantiation (#6193)
$ npm run build
$ git bisect bad
Bisecting: 0 revisions left to test after this (roughly 0 steps)
[c76804eea2afcd3df4e01d5a8db3ae2c4c553aee] Avoid React StrictMode error when query resolves after unmount (#6216)
$ npm run build
$ git bisect bad
c76804eea2afcd3df4e01d5a8db3ae2c4c553aee is the first bad commit
commit c76804eea2afcd3df4e01d5a8db3ae2c4c553aee
Author: Grex <grxy@users.noreply.github.com>
Date: Tue Jun 2 09:45:10 2020 -0600
Avoid React StrictMode error when query resolves after unmount (#6216)
src/react/data/QueryData.ts | 6 ++--
src/react/hooks/__tests__/useQuery.test.tsx | 43 +++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 3 deletions(-) |
@darkbasic thanks for the comment, subscribed to that one as well. Will continue to investigate here and see if I can submit a fix. If I manage that, we can see if that issue is also resolved 👍 |
Heads up: we reverted #6216 for now in |
Closing because I believe this is fixed. Thanks for reporting (and bisecting), @LinusU! |
Sorry for the bad title, didn't know how to summarise this any better.
We are using Apollo local state to store shopping carts in our app. After updating to
3.0.0-rc.0
from3.0.0-beta.54
we had one of ouruseQuery
no longer returning any data. By adding some logging, I've managed to get a somewhat clear picture of what is happening, although I cannot understand why or how to make it work:Our component basically looks like this:
and our resolvers like this:
With that in place, this is what is being logged:
The problem is that then nothing more happens, so the component never re-renders after getting the data from the resolvers.
Intended outcome:
I expected the
useQuery
call to run again and give me back the data, which would result in the following additional logs:Actual outcome:
useQuery
doesn't give me anydata
at all, and is just stuck in the "loading" state indefinitely...But, if I make another modification to the cache while that component is still rendering, the
useQuery
resolves and give me back the data.How to reproduce the issue:
I haven't been able to narrow this down more, working on it currently...
Versions
The text was updated successfully, but these errors were encountered: