https://github.com/lucasconstantino/apollo-link-combine-includes
Apollo Link that performs merging of similar operation requests
https://github.com/lucasconstantino/apollo-link-combine-includes
apollo apollo-client apollo-link graphql
Last synced: about 2 months ago
JSON representation
Apollo Link that performs merging of similar operation requests
- Host: GitHub
- URL: https://github.com/lucasconstantino/apollo-link-combine-includes
- Owner: lucasconstantino
- License: mit
- Created: 2018-10-10T04:19:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-16T16:51:14.000Z (about 6 years ago)
- Last Synced: 2025-03-22T00:35:22.252Z (2 months ago)
- Topics: apollo, apollo-client, apollo-link, graphql
- Language: JavaScript
- Size: 137 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Combine Includes Link
[](https://travis-ci.org/lucasconstantino/apollo-link-combine-includes)
[](https://codecov.io/github/lucasconstantino/apollo-link-combine-includes)
[](https://www.npmjs.com/package/apollo-link-combine-includes)
[](https://taller.net.br/en/)## ⚠️ Be careful
This project is a crazy experiment, did work with a quite complicated scenario, but is honestly not
yet stressed enough to consider it not error prone, or even stable.## Purpose
An Apollo Link that combines multiple same-query requests using different
include/skip directives into a single query.## Installation
`npm install apollo-link-combine-includes --save`
## Usage
```js
import { CombineIncludesLink } from 'apollo-link-combine-includes'const link = new CombineIncludesLink()
```## Options
Batch Link takes an object with three options on it to customize the behavior of the link. The only required option is the batchHandler function
| name | value | default | required |
| ------------- | -------------------------------------------------------------- | ------------------------------------------- | -------- |
| batchInterval | number | 10 | false |
| batchMax | number | 0 | false |
| canCombine | (operation: Operation, defaultCanCombine: function) => Boolean | Operation has a name and include directives | false |## Context
The CombineIncludesLink does not use the context for anything