-
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
Making ApolloStore extensible #3461
Comments
HI @lincolnq 👋🏻 - we have discussed the extensibility of
It is not the cache, nor the store implementation, that is rejecting missing response values. You can test this yourself by using a request cache policy to completely ignore the cache. The operation will still fail if there are missing response values. The logic for this behaviour lives within our GraphQL executor and it is built to be compliant with the GraphQL specification. |
What was the implementation you were thinking you could achieve this? What additional logic would your store have? |
Ok thanks - I'm working on a PR, but I do have a local demo that does what I want overriding ApolloStore to specify My local demo requires importing Apollo as |
Ok, here's the PR: apollographql/apollo-ios-dev#509 |
Use case
Goal: Make it easier to customize behavior of the Apollo normalized cache.
Currently,
ApolloStore
is a concrete class depended-on by lots of Apollo internals. It's not markedopen
, nor is it a protocol, so in practice there is no way without modifying Apollo code for applications to customize the store behavior.[context: My specific use-case is one that has been touched-on/requested a number of places (#3319, #892, #3216: make the Apollo cache accept missing values for nullable fields as null, rather than failing to parse them.) While Apollo team has resisted adding a flag, if ApolloStore were extensible I could implement the behavior I want myself without forking all of apollo-ios.]
I would be fine if it were necessary to use
@_spi(Execution)
to override some ApolloStore behavior, flagging to end-users that the APIs may change. I just want to be able to override stuff without forking the entire repo.Describe the solution you'd like
open
and make more of its functionspublic
/open
ReadTransaction.readObject
public
(gated with@_spi(Execution)
as appropriate):performAsyncIfNeeded
)GraphQLDependencyTracker
ApolloStore
. Rename the current implementation toNormalizedCacheApolloStore
and instantiate it wherever ApolloStore is currently instantiated.I can work on this but wanted to check with the team about whether it is likely to be accepted.
The text was updated successfully, but these errors were encountered: