-
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
After updating query data with subscribeToMore the query data in the component is empty #3962
Comments
I had a different bug with similar symptoms: the store content would update, but the component would render with outdated data. Something is amiss in the new caching behavior as introduced by #3394 - I tried to come up with a simple test-case but couldn't pinpoint it yet. For now, had to revert all projects to v1.2.x. |
@cruzj6 Do you think you could put together a small runnable reproduction in the form of a github repository? Happy to look into this today, though downgrading |
For example, here's a React Apollo subscription example app that seems roughly similar to yours, but still works after I update If you can identify what's different between that example app and your app, that would be a great place to start. Maybe you could clone that app, and then update it to look more and more like your app, until it begins to exhibit the problem? |
Please try the latest version of npm install apollo-cache-inmemory@next Specifically, that commit reverts a previous commit of mine that attempted to handle adding |
@cruzj6 Any chance to try the latest version? |
Please try updating to |
@benjamn I tried 1.3.5 and my issue still remains. But I still don't have an isolated test-case, so there is a good chance my issue is somewhere in my code rather than upstream in here. |
@benjamn Sorry for the delayed response. I have updated to 1.3.5 and I no longer see the issue that I originally reported for subscriptions. Thank you for the fix! |
Intended outcome:
Update to apollo-cache-inmemory 1.3.0.
Actual outcome:
This below code no longer works as expected in the new version. The initial query is fine and I get the message data. When the
subscribeToMore.updateQuery
updates the query's cached messages data, the component re-renders with the data object being{}
. I verified this only happens with version 1.3.0, and not with the previous version I was using (1.2.10). The strange part is that in the devTools the cached data looks correct, but when it gets to the component level it is empty.Problem code:
How to reproduce the issue:
Create a query to get initial data and use the
subscribeToMore
callback to update it's data from a graphql subscription.Versions
The text was updated successfully, but these errors were encountered: