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
Reason to use writeFragment instead of toReference #12
Comments
Hi, thanks so much for your heads-up! I've read through the comment you've linked and its follow-ups, and I can't help but wonder if the described problems are only relevant if you call If you call |
Ok, I think you're right, in the modifiers option it shouldn't make a difference. I ran into this issue when indeed doing a cache.modify in isolation (some data that comes in over a websocket and should update the cache), but for the use-cases you mention it's indeed a non-issue. |
Alright, great! I've updated the documentation accordingly (423cdbc). Thanks again for your input! |
This is just a remark:
I was looking in the documentation where it says:
But there is actually a reason to use writeFragment. The problem is that toReference will only deal with scalars. So if you have any custom types (e.g. dates), these will not end up correctly in the cache. writeFragment, although way more verbose, does take care of that.
This is explained by an Apollo dev a bit more extensive here: apollographql/apollo-client#6289 (comment)
The text was updated successfully, but these errors were encountered: