Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/api/smart-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Each query declared in the `apollo` definition (that is, which doesn't start wit
- `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.
- `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).
- `deep` is a boolean to use `deep: true` on Vue watchers.
- `skip` is a boolean or a (reactive) function that returns a boolean. The function gets the current component and smart query key as arguments, so it can be used in `$query` and in `ApolloProvider`'s `defaultOptions`.
- `subscribeToMore`: an object or an array of object which are [subscribeToMore options](../guide/apollo/subscriptions.md#subscribetomore).
- `prefetch` is either a boolean or a function to determine if the query should be prefetched. See [Server-Side Rendering](../guide/ssr.md).
- You can also use any other `watchQuery` options (see [Apollo docs](https://www.apollographql.com/docs/react/api/apollo-client.html#ApolloClient.watchQuery)).
Expand Down
1 change: 1 addition & 0 deletions docs/api/smart-subscription.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Each subscription declared in the `apollo.$subscribe` option in a component resu
- `debounce`: debounce variables updates (in ms).
- `result(data, key)` is a hook called when a result is received
- `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.
- `skip` is a boolean or a (reactive) function that returns a boolean. The function gets the current component and smart query key as arguments, so it can be used in `$query` and in `ApolloProvider`'s `defaultOptions`.

## Properties

Expand Down
2 changes: 1 addition & 1 deletion src/smart-apollo.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class SmartApollo {

autostart () {
if (typeof this.options.skip === 'function') {
this._skipWatcher = this.vm.$watch(this.options.skip.bind(this.vm), this.skipChanged.bind(this), {
this._skipWatcher = this.vm.$watch(() => this.options.skip.call(this.vm, this.vm, this.key), this.skipChanged.bind(this), {
immediate: true,
deep: this.options.deep,
})
Expand Down
2 changes: 1 addition & 1 deletion tests/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"apollo:dev": "vue-cli-service apollo:watch",
"apollo:dev": "vue-cli-service apollo:dev",
"apollo:start": "vue-cli-service apollo:start --port 4042",
"test:e2e:dev": "start-server-and-test apollo:dev http://localhost:4042/.well-known/apollo/server-health test:e2e:dev:client",
"test:e2e:dev:client": "vue-cli-service test:e2e --mode development",
Expand Down