Skip to content
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

Prepare for Optimistic update store #584

Merged
merged 8 commits into from
Jul 29, 2017

Conversation

sav007
Copy link
Contributor

@sav007 sav007 commented Jul 23, 2017

  • Introduce ApolloInterceptor.InterceptorRequest that will hold request data such as: operation, optimistic updates, fetch options. Request will be passed to the interceptor chain to be processed.
  • ApolloInterceptor.InterceptorRequest has unique identifier to be used later as Record version to build relationship between records in optimistic store and request which made those records from optimistic data. It will allow to build rollback mechanism, remove records from optimistic store by the request identifier / version.
  • A little refactoring of Record object

Next step is to introduce OptimisticNormalizedCache (will be based on top of LruNormalizedCache), plus would be nice to consider create generic abstraction of chaining different implementations of normalized caches and have similar logic that we have for LruNormalizedCache with second cache. So if we can't resolve Record from current layer of cache we ask down the chain the next layer and so on.

- Introduce ApolloInterceptor.InterceptorRequest that will hold request data such as: operation, optimistic updates, fetch options. Request will be passed to the interceptor chain to be processed.
- ApolloInterceptor.InterceptorRequest has unique identifier to be used later as Record version to build relationship between records in optimistic store and request which made those records from optimistic data. It will allow to build rollback mechanism, remove records from optimistic store by the request identifier / version.
- A little refactoring of Record object

Next step is introduce OptimisticNormalizedCache (will be based on top of LruNormalizedCache), plus would be nice to consider create generic abstraction of chaining different implementations of normalized caches and have similar logic that we have for LruNormalizedCache with second cache. So if we can't resolve Record from current layer of cache we ask down the chain the next layer and so on.
@sav007 sav007 merged commit 2e40c88 into apollographql:master Jul 29, 2017
@sav007 sav007 deleted the feature-583/prepare branch July 29, 2017 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants