Fix unnecessary refresh

This commit is contained in:
Guillaume Chau
2016-12-30 23:04:03 +01:00
parent 617703642c
commit 0661461398
2 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "vue-apollo",
"version": "1.2.1",
"version": "1.2.2",
"description": "Vue apollo integration",
"main": "index.js",
"scripts": {
+3 -4
View File
@@ -12,12 +12,11 @@ class SmartApollo {
// Query callback
if (typeof this.options.query === 'function') {
const queryCb = this.options.query
this.vm.$watch(queryCb.bind(this.vm), query => {
const queryCb = this.options.query.bind(this.vm)
this.options.query = queryCb()
this.vm.$watch(queryCb, query => {
this.options.query = query
this.refresh()
}, {
immediate: true,
})
}