Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
useQuery: useEffect doesn't run on cache update #3357
Intended outcome: After updating the cache via
Actual outcome: A re-render was triggered but
How to reproduce the issue:
Pay attention to the peoples count.
Have you tried avoiding to mutate the local store data? I had a somewhat similar issue (component not rerendering although the store had been updated), and this turned out to solve my problem. You can configure your Apollo Client instance to enforce immutability, which might come with a performance benefit as well: see apollographql/apollo-client#4543
I've updated the example to @lensbart advice, seems working better now. Wtyt?