-
Notifications
You must be signed in to change notification settings - Fork 734
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
Fix writing a query with variables to the store. #394
Conversation
@kevbuchanan: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/ |
On further testing of this, it looks like this is an issue at any level of the object, so just updating the top level keys won't work. Using a |
Hey @kevbuchanan! You're awesome for taking a stab at tackling this :) Seeing I'm the one who reported the original ticket.. is there anything I can do to help get this feature merged? Also, we should think about making the |
@Nickersoft Not sure what else needs to be done here. As far as making the |
I suppose my concern there @kevbuchanan is just the fact I wasn't sure that if you defined a store, passed it into the ApolloClient constructor, then called a write-to-cache method on the store variable, if it would actually update the Apollo cache. From what I saw the constructor copies to the passed store variable to a member variable by-value, which would mean you'd have to call the write cache method on the class member directly. That is, unless I'm mistaken somewhere. I am relatively new to Swift, and am not 100% on how the cache is handled and propagated internally. |
please merge this 👍 |
Can anyone make sense of why the build might be failing? I can't find a solid error message |
@kevbuchanan @rad182 Created a separate PR that exposes the methods needed for writing to the store and features this fix: #413. This will ideally let me fix any build issues as they arise and hopefully push this feature through. |
Closing in favor of #413 |
This issue is also discussed in #357
The ReadWriteTransaction's resolver expects the cache key to be in the object data. When writing to the store, the data will not already have this. The existing tests for this didn't include a query with variables, which would cause the lookup to fail.
I'm not sure if the below is the best way to fix this. Seems like either the data needs to have the cache key added, or the write needs to use a different resolver that just uses the field name.