Now supports multiple subscribeToMore on query
This commit is contained in:
@@ -743,6 +743,8 @@ apollo: {
|
||||
}
|
||||
```
|
||||
|
||||
*Note that you can pass an array of subscriptions to `subscribeToMore` to subscribe to multiple subcribtions on this query.*
|
||||
|
||||
#### Alternate usage
|
||||
|
||||
You can access the queries you defined in the `apollo` option with `this.$apollo.queries.<name>`, so it would look like this:
|
||||
|
||||
+15
-5
@@ -77,11 +77,21 @@ export class DollarApollo {
|
||||
const smart = this.queries[key] = new SmartQuery(this.vm, key, options, false)
|
||||
smart.autostart()
|
||||
|
||||
if (options.subscribeToMore) {
|
||||
this.addSmartSubscription(key, {
|
||||
...options.subscribeToMore,
|
||||
linkedQuery: smart,
|
||||
})
|
||||
const subs = options.subscribeToMore
|
||||
if (subs) {
|
||||
if (Array.isArray(subs)) {
|
||||
subs.forEach((sub, index) => {
|
||||
this.addSmartSubscription(`${key}${index}`, {
|
||||
...sub,
|
||||
linkedQuery: smart,
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.addSmartSubscription(key, {
|
||||
...subs,
|
||||
linkedQuery: smart,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return smart
|
||||
|
||||
Reference in New Issue
Block a user