You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These are the available advanced options you can use:
405
405
-`update(data) {return ...}` to customize the value that is set in the vue property, for example if the field names don't match.
406
406
-`result(ApolloQueryResult)` is a hook called when a result is received (see documentation for [ApolloQueryResult](http://dev.apollodata.com/core/apollo-client-api.html#ApolloQueryResult)).
407
-
-`error(error)` is a hook called when there are errors,`error`being an Apollo error object with either a `graphQLErrors` property or a `networkError` property.
408
-
-`loadingKey` will update the component data property you pass as the value. You should initialize this property to `0` in the component `data()` hook. When the query is loading, this property will be incremented by 1 and as soon as it no longer is, the property will be decremented by 1. That way, the property can represent a counter of currently loading queries.
409
-
-`watchLoading(isLoading, countModifier)` is a hook called when the loading state of the query changes. The `countModifier` parameter is either equal to `1` when the query is now loading, or `-1` when the query is no longer loading.
410
-
-`manual` is a boolean that disable the automatic property update. You then need to specify a `result` callback (see example below).
407
+
-`error(error)` is a hook called when there are errors.`error`is an Apollo error object with either a `graphQLErrors` property or a `networkError` property.
408
+
-`loadingKey` will update the component data property you pass as the value. You should initialize this property to `0` in the component `data()` hook. When the query is loading, this property will be incremented by 1; when it is no longer loading, it will be decremented by 1. That way, the property can represent a counter of currently loading queries.
409
+
-`watchLoading(isLoading, countModifier)` is a hook called when the loading state of the query changes. The `countModifier` parameter is either equal to `1` when the query is loading, or `-1` when the query is no longer loading.
410
+
-`manual` is a boolean to disable the automatic property update. If you use it, you then need to specify a `result` callback (see example below).
411
411
412
412
413
413
```javascript
@@ -562,7 +562,7 @@ created () {
562
562
563
563
## Mutations
564
564
565
-
Mutations are queries that changes your data state on your apollo server. For more info, visit the [apollo doc](http://dev.apollodata.com/core/apollo-client-api.html#ApolloClient\.mutate).
565
+
Mutations are queries that change your data state on your apollo server. For more info, visit the [apollo doc](http://dev.apollodata.com/core/apollo-client-api.html#ApolloClient\.mutate).
566
566
567
567
```javascript
568
568
methods: {
@@ -743,9 +743,9 @@ apollo: {
743
743
label
744
744
}
745
745
}`,
746
-
// Variables passed to the subscription
746
+
// Variables passed to the subscription. Since we're using a function,
747
+
// they are reactive
747
748
variables () {
748
-
// Reactive if a function (like previously)
749
749
return {
750
750
param:this.param,
751
751
}
@@ -759,7 +759,7 @@ apollo: {
759
759
}
760
760
```
761
761
762
-
*Note that you can pass an array of subscriptions to `subscribeToMore` to subscribe to multiple subcribtions on this query.*
762
+
*Note that you can pass an array of subscriptions to `subscribeToMore` to subscribe to multiple subscriptions on this query.*
763
763
764
764
#### Alternate usage
765
765
@@ -906,7 +906,7 @@ apollo: {
906
906
907
907
You can then access the subscription with `this.$apollo.subscriptions.<name>`.
908
908
909
-
*Just like queries, you can declare the subscription [with a function](#option-function), and you can declare the `query` option [with a reactive function](#reactive-query-definition).*
909
+
*Just like for queries, you can declare the subscription [with a function](#option-function), and you can declare the `query` option [with a reactive function](#reactive-query-definition).*
910
910
911
911
### Skipping the subscription
912
912
@@ -1058,7 +1058,7 @@ export default {
1058
1058
1059
1059
## Special options
1060
1060
1061
-
The special options being with `$` in the `apollo` object.
1061
+
The special options begin with `$` in the `apollo` object.
1062
1062
1063
1063
-`$skip` to disable all queries and subscriptions (see below)
1064
1064
-`$skipAllQueries` to disable all queries (see below)
You can also declare these properties in the `apollo` option of the component. It can be booleans:
1111
+
You can also declare these properties in the `apollo` option of the component. They can be booleans:
1112
1112
1113
1113
```javascript
1114
1114
apollo: {
@@ -1168,7 +1168,7 @@ On the queries you want to prefetch on the server, add the `prefetch` option. It
1168
1168
- a function that gets the context object (which can contain the URL for example) and return a variables object,
1169
1169
-`true` (query's `variables` is reused).
1170
1170
1171
-
If you are returning a variables object in the `prefetch` option make sure it matches with the result of the `variables` option. If they do not match the query's data property will not be populated while rendering the template server-side.
1171
+
If you are returning a variables object in the `prefetch` option, make sure it matches the result of the `variables` option. If they do not match, the query's data property will not be populated while rendering the template server-side.
1172
1172
1173
1173
**Warning! You don't have access to the component instance when doing prefetching on the server. Don't use `this` in `prefetch`!**
1174
1174
@@ -1219,7 +1219,7 @@ export default {
1219
1219
}
1220
1220
```
1221
1221
1222
-
You can also tell vue-apollo that some components not used in a `router-view` (and thus not in vue-router `matchedComponents`) need to be prefetched, with the `willPrefetch` method:
1222
+
You can also tell vue-apollo that some components not used in a `router-view` (and thus, not in vue-router `matchedComponents`) need to be prefetched, with the `willPrefetch` method:
1223
1223
1224
1224
```javascript
1225
1225
import { willPrefetch } from'vue-apollo'
@@ -1281,7 +1281,7 @@ return new Promise((resolve, reject) => {
1281
1281
}, matchedComponents),
1282
1282
]).then(() => {
1283
1283
// Inject the Vuex state and the Apollo cache on the page.
0 commit comments