Skip to content

Commit 3d582f3

Browse files
author
Guillaume Chau
committed
chore: v3.0.0-beta.10
1 parent 916675f commit 3d582f3

File tree

4 files changed

+98
-22
lines changed

4 files changed

+98
-22
lines changed

dist/vue-apollo.esm.js

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2787,6 +2787,26 @@ var SmartQuery = function (_SmartApollo) {
27872787
_this.type = 'query';
27882788
_this.vueApolloSpecialKeys = VUE_APOLLO_QUERY_KEYWORDS;
27892789
_this._loading = false;
2790+
2791+
2792+
_this.hasDataField = _this.vm.$data.hasOwnProperty(key);
2793+
if (_this.hasDataField) {
2794+
Object.defineProperty(_this.vm.$data.$apolloData.data, key, {
2795+
get: function get$$1() {
2796+
return _this.vm.$data[key];
2797+
},
2798+
enumerable: true,
2799+
configurable: true
2800+
});
2801+
} else {
2802+
Object.defineProperty(_this.vm.$data, key, {
2803+
get: function get$$1() {
2804+
return _this.vm.$data.$apolloData.data[key];
2805+
},
2806+
enumerable: true,
2807+
configurable: true
2808+
});
2809+
}
27902810
return _this;
27912811
}
27922812

@@ -2861,11 +2881,11 @@ var SmartQuery = function (_SmartApollo) {
28612881
// No result
28622882
} else if (!this.options.manual) {
28632883
if (typeof this.options.update === 'function') {
2864-
this.vm.$set(this.vm.$data.$apolloData.data, this.key, this.options.update.call(this.vm, data));
2884+
this.setData(this.options.update.call(this.vm, data));
28652885
} else if (data[this.key] === undefined) {
28662886
console.error('Missing ' + this.key + ' attribute on result', data);
28672887
} else {
2868-
this.vm.$set(this.vm.$data.$apolloData.data, this.key, data[this.key]);
2888+
this.setData(data[this.key]);
28692889
}
28702890
} else if (!hasResultCallback) {
28712891
console.error(this.key + ' query must have a \'result\' hook in manual mode');
@@ -2875,6 +2895,11 @@ var SmartQuery = function (_SmartApollo) {
28752895
this.options.result.call(this.vm, result);
28762896
}
28772897
}
2898+
}, {
2899+
key: 'setData',
2900+
value: function setData(value) {
2901+
this.vm.$set(this.hasDataField ? this.vm.$data : this.vm.$data.$apolloData.data, this.key, value);
2902+
}
28782903
}, {
28792904
key: 'catchError',
28802905
value: function catchError(error) {
@@ -3276,7 +3301,12 @@ var DollarApollo = function () {
32763301
}, {
32773302
key: 'loading',
32783303
get: function get$$1() {
3279-
return this.vm.$data.$apolloData && this.vm.$data.$apolloData.loading !== 0;
3304+
return this.vm.$data.$apolloData.loading !== 0;
3305+
}
3306+
}, {
3307+
key: 'data',
3308+
get: function get$$1() {
3309+
return this.vm.$data.$apolloData.data;
32803310
}
32813311
}, {
32823312
key: 'skipAllQueries',
@@ -3888,6 +3918,10 @@ var CApolloMutation = {
38883918

38893919
var keywords = ['$subscribe'];
38903920

3921+
function hasProperty(holder, key) {
3922+
return typeof holder !== 'undefined' && holder.hasOwnProperty(key);
3923+
}
3924+
38913925
var launch = function launch() {
38923926
var _this = this;
38933927

@@ -3917,16 +3951,20 @@ var launch = function launch() {
39173951
defineReactiveSetter(this.$apollo, 'error', apollo.$error);
39183952
defineReactiveSetter(this.$apollo, 'watchLoading', apollo.$watchLoading);
39193953

3954+
// Apollo Data
3955+
Object.defineProperty(this, '$apolloData', {
3956+
get: function get$$1() {
3957+
return _this.$data.$apolloData;
3958+
},
3959+
enumerable: true,
3960+
configurable: true
3961+
});
3962+
39203963
// watchQuery
39213964

39223965
var _loop = function _loop(key) {
39233966
if (key.charAt(0) !== '$') {
3924-
var propHasKeyProperty = false;
3925-
if (typeof _this.$props !== 'undefined') {
3926-
propHasKeyProperty = _this.$props.hasOwnProperty(key);
3927-
}
3928-
3929-
if (!_this.hasOwnProperty(key) && !propHasKeyProperty && !_this.$data.hasOwnProperty(key)) {
3967+
if (!hasProperty(_this, key) && !hasProperty(_this.$props, key) && !hasProperty(_this.$data, key)) {
39303968
Object.defineProperty(_this, key, {
39313969
get: function get$$1() {
39323970
return _this.$data.$apolloData.data[key];
@@ -4051,7 +4089,7 @@ function install(Vue, options) {
40514089
ApolloProvider.install = install;
40524090

40534091
// eslint-disable-next-line no-undef
4054-
ApolloProvider.version = "3.0.0-beta.9";
4092+
ApolloProvider.version = "3.0.0-beta.10";
40554093

40564094
// Apollo provider
40574095
var ApolloProvider$1 = ApolloProvider;

dist/vue-apollo.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-apollo.umd.js

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2793,6 +2793,26 @@ var SmartQuery = function (_SmartApollo) {
27932793
_this.type = 'query';
27942794
_this.vueApolloSpecialKeys = VUE_APOLLO_QUERY_KEYWORDS;
27952795
_this._loading = false;
2796+
2797+
2798+
_this.hasDataField = _this.vm.$data.hasOwnProperty(key);
2799+
if (_this.hasDataField) {
2800+
Object.defineProperty(_this.vm.$data.$apolloData.data, key, {
2801+
get: function get$$1() {
2802+
return _this.vm.$data[key];
2803+
},
2804+
enumerable: true,
2805+
configurable: true
2806+
});
2807+
} else {
2808+
Object.defineProperty(_this.vm.$data, key, {
2809+
get: function get$$1() {
2810+
return _this.vm.$data.$apolloData.data[key];
2811+
},
2812+
enumerable: true,
2813+
configurable: true
2814+
});
2815+
}
27962816
return _this;
27972817
}
27982818

@@ -2867,11 +2887,11 @@ var SmartQuery = function (_SmartApollo) {
28672887
// No result
28682888
} else if (!this.options.manual) {
28692889
if (typeof this.options.update === 'function') {
2870-
this.vm.$set(this.vm.$data.$apolloData.data, this.key, this.options.update.call(this.vm, data));
2890+
this.setData(this.options.update.call(this.vm, data));
28712891
} else if (data[this.key] === undefined) {
28722892
console.error('Missing ' + this.key + ' attribute on result', data);
28732893
} else {
2874-
this.vm.$set(this.vm.$data.$apolloData.data, this.key, data[this.key]);
2894+
this.setData(data[this.key]);
28752895
}
28762896
} else if (!hasResultCallback) {
28772897
console.error(this.key + ' query must have a \'result\' hook in manual mode');
@@ -2881,6 +2901,11 @@ var SmartQuery = function (_SmartApollo) {
28812901
this.options.result.call(this.vm, result);
28822902
}
28832903
}
2904+
}, {
2905+
key: 'setData',
2906+
value: function setData(value) {
2907+
this.vm.$set(this.hasDataField ? this.vm.$data : this.vm.$data.$apolloData.data, this.key, value);
2908+
}
28842909
}, {
28852910
key: 'catchError',
28862911
value: function catchError(error) {
@@ -3282,7 +3307,12 @@ var DollarApollo = function () {
32823307
}, {
32833308
key: 'loading',
32843309
get: function get$$1() {
3285-
return this.vm.$data.$apolloData && this.vm.$data.$apolloData.loading !== 0;
3310+
return this.vm.$data.$apolloData.loading !== 0;
3311+
}
3312+
}, {
3313+
key: 'data',
3314+
get: function get$$1() {
3315+
return this.vm.$data.$apolloData.data;
32863316
}
32873317
}, {
32883318
key: 'skipAllQueries',
@@ -3894,6 +3924,10 @@ var CApolloMutation = {
38943924

38953925
var keywords = ['$subscribe'];
38963926

3927+
function hasProperty(holder, key) {
3928+
return typeof holder !== 'undefined' && holder.hasOwnProperty(key);
3929+
}
3930+
38973931
var launch = function launch() {
38983932
var _this = this;
38993933

@@ -3923,16 +3957,20 @@ var launch = function launch() {
39233957
defineReactiveSetter(this.$apollo, 'error', apollo.$error);
39243958
defineReactiveSetter(this.$apollo, 'watchLoading', apollo.$watchLoading);
39253959

3960+
// Apollo Data
3961+
Object.defineProperty(this, '$apolloData', {
3962+
get: function get$$1() {
3963+
return _this.$data.$apolloData;
3964+
},
3965+
enumerable: true,
3966+
configurable: true
3967+
});
3968+
39263969
// watchQuery
39273970

39283971
var _loop = function _loop(key) {
39293972
if (key.charAt(0) !== '$') {
3930-
var propHasKeyProperty = false;
3931-
if (typeof _this.$props !== 'undefined') {
3932-
propHasKeyProperty = _this.$props.hasOwnProperty(key);
3933-
}
3934-
3935-
if (!_this.hasOwnProperty(key) && !propHasKeyProperty && !_this.$data.hasOwnProperty(key)) {
3973+
if (!hasProperty(_this, key) && !hasProperty(_this.$props, key) && !hasProperty(_this.$data, key)) {
39363974
Object.defineProperty(_this, key, {
39373975
get: function get$$1() {
39383976
return _this.$data.$apolloData.data[key];
@@ -4057,7 +4095,7 @@ function install(Vue, options) {
40574095
ApolloProvider.install = install;
40584096

40594097
// eslint-disable-next-line no-undef
4060-
ApolloProvider.version = "3.0.0-beta.9";
4098+
ApolloProvider.version = "3.0.0-beta.10";
40614099

40624100
// Apollo provider
40634101
var ApolloProvider$1 = ApolloProvider;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-apollo",
3-
"version": "3.0.0-beta.9",
3+
"version": "3.0.0-beta.10",
44
"description": "Use Apollo and GraphQL with Vue.js",
55
"main": "dist/vue-apollo.umd.js",
66
"module": "dist/vue-apollo.esm.js",

0 commit comments

Comments
 (0)