-
Notifications
You must be signed in to change notification settings - Fork 749
Description
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 marked open, 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
- Mark ApolloStore
openand make more of its functionspublic/open- 4-argument
ReadTransaction.readObject
- 4-argument
- Make its implementation dependencies
public(gated with@_spi(Execution)as appropriate):- DispatchQueue extensions (
performAsyncIfNeeded) GraphQLDependencyTracker
- DispatchQueue extensions (
- Maybe even: define ApolloStore's public interface as a protocol called
ApolloStore. Rename the current implementation toNormalizedCacheApolloStoreand 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.