-
Notifications
You must be signed in to change notification settings - Fork 28
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
Limit to mutations only #13
Comments
I think you can write a wrapper that only calls the queue link for mutations: import { ApolloLink } from 'apollo-link';
function isMutationOperation(operation) {
return operation.query.definitions.filter((e) => e.operation === 'mutation').length > 0;
}
const queueLink = new QueueLink();
const onlyQueueMutationsLink = new ApolloLink((operation, forward) =>
isMutationOperation(operation) ? queueLink.request(operation, forward) : forward(operation)
); |
I'm happy to write this along with #3. Idea will be to be able to pass filter and storage interface to queue.
|
Done in: #14 |
Thanks for the effort @wtrocki. I like to keep things as simple as possible and separate concerns, so I would recommend using @pl12133 's approach here. The philosophy of apollo link is like the Unix philosophy where each utility is small and limited in scope but input and output can be piped. More complex things can then be done by combining simple links together. |
Is is possible to queue only muatations and not queries?
The text was updated successfully, but these errors were encountered: