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
allow users to pass link compositions and custom caches #62
Conversation
This is really needed as unions and interfaces are pretty much useless with apollo without a fragmentMatcher which can't be provided at the moment |
packages/aws-appsync/src/client.js
Outdated
const cache = disableOffline ? new InMemoryCache() : new OfflineCache(store); | ||
|
||
const cache = disableOffline | ||
? ownCache ? owncache : new InMemoryCache() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assignment would be cleaner if you swap the ternary operators:
const cache = ownCache ? ownCache
: disableOffline ? new InMemoryCache()
: new OfflineCache(store);
There also seems to be a typo on line 56: owncache
should be ownCache
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed with this feedback as it is a lot more readable.
I think there should be a way to add links without having to redefine the AWS links. I don't want to have to manually keep track of AWS internal SDK changes in order to get all of the out-of-the-box functionality when supplying a custom link. Maybe a function that can return an array of the AWS supplied links that can be used in the following way: in my case, I'm looking to use a link to stripout __typename properties on objects submitted to mutations, not override any AWS provided functionality. |
Allows the usage of: - Custom link - Custom cache - Custom cache options Fixes awslabs#3 Fixes awslabs#21 Fixes awslabs#24 Fixes awslabs#36 Fixes awslabs#52 Fixes awslabs#70 Fixes awslabs#87 Closes awslabs#62
Hey This should be possible soon, take a look at #96 and these comments with usage examples: |
* Use custom link cache and cache options Allows the usage of: - Custom link - Custom cache - Custom cache options Fixes #3 Fixes #21 Fixes #24 Fixes #36 Fixes #52 Fixes #70 Fixes #87 Closes #62 * Pass store to OfflineLink when using createAppSyncLink * Fix eslint rules violations * Fix typo. Address CR comment.
We need to be able to pass in our own links along with the lovely links from AWS.
Likewise for an Apollo cache (especially since we want to use the same cache we use for the client in say apollo-link-state, cause that's what I was told to do)
This should help with: #52 #36 #24 #21 #3
Let me know if this looks good, interesting, undesirable, or needs work.
Cheers,
JP