Skip to content

Commit 73c9c2a

Browse files
author
Guillaume Chau
committed
fix: #239 skip prop proxy if query is manual
1 parent effec93 commit 73c9c2a

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const launch = function launch () {
5656
options = Object.assign({}, apollo.$query, options)
5757
}
5858
// Property proxy
59-
if (!hasProperty(this, key) && !hasProperty(this.$props, key) && !hasProperty(this.$data, key)) {
59+
if (!options.manual && !hasProperty(this, key) && !hasProperty(this.$props, key) && !hasProperty(this.$data, key)) {
6060
Object.defineProperty(this, key, {
6161
get: () => this.$data.$apolloData.data[key],
6262
enumerable: true,

src/smart-query.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,21 @@ export default class SmartQuery extends SmartApollo {
2424

2525
super(vm, key, options, autostart)
2626

27-
this.hasDataField = this.vm.$data.hasOwnProperty(key)
28-
if (this.hasDataField) {
29-
Object.defineProperty(this.vm.$data.$apolloData.data, key, {
30-
get: () => this.vm.$data[key],
31-
enumerable: true,
32-
configurable: true,
33-
})
34-
} else {
35-
Object.defineProperty(this.vm.$data, key, {
36-
get: () => this.vm.$data.$apolloData.data[key],
37-
enumerable: true,
38-
configurable: true,
39-
})
27+
if (!options.manual) {
28+
this.hasDataField = this.vm.$data.hasOwnProperty(key)
29+
if (this.hasDataField) {
30+
Object.defineProperty(this.vm.$data.$apolloData.data, key, {
31+
get: () => this.vm.$data[key],
32+
enumerable: true,
33+
configurable: true,
34+
})
35+
} else {
36+
Object.defineProperty(this.vm.$data, key, {
37+
get: () => this.vm.$data.$apolloData.data[key],
38+
enumerable: true,
39+
configurable: true,
40+
})
41+
}
4042
}
4143
}
4244

0 commit comments

Comments
 (0)