Skip to content

Commit 4eb30c7

Browse files
loitranAkryum
authored andcommitted
fixed: receiving error if _this. is not defined #275 (#279)
* fixed: receiving error if _this. is not defined #275 * fixed: receiving error if _this. is not defined #275
1 parent 15f5c20 commit 4eb30c7

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

dist/vue-apollo.esm.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3921,7 +3921,12 @@ var launch = function launch() {
39213921

39223922
var _loop = function _loop(key) {
39233923
if (key.charAt(0) !== '$') {
3924-
if (!_this.hasOwnProperty(key) && !_this.$props.hasOwnProperty(key) && !_this.$data.hasOwnProperty(key)) {
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)) {
39253930
Object.defineProperty(_this, key, {
39263931
get: function get$$1() {
39273932
return _this.$data.$apolloData.data[key];

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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3927,7 +3927,12 @@ var launch = function launch() {
39273927

39283928
var _loop = function _loop(key) {
39293929
if (key.charAt(0) !== '$') {
3930-
if (!_this.hasOwnProperty(key) && !_this.$props.hasOwnProperty(key) && !_this.$data.hasOwnProperty(key)) {
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)) {
39313936
Object.defineProperty(_this, key, {
39323937
get: function get$$1() {
39333938
return _this.$data.$apolloData.data[key];

src/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ const launch = function launch () {
4040
// watchQuery
4141
for (let key in apollo) {
4242
if (key.charAt(0) !== '$') {
43-
if (!this.hasOwnProperty(key) && !this.$props.hasOwnProperty(key) && !this.$data.hasOwnProperty(key)) {
43+
let propHasKeyProperty = false
44+
if (typeof this.$props !== 'undefined') {
45+
propHasKeyProperty = this.$props.hasOwnProperty(key)
46+
}
47+
48+
if (!this.hasOwnProperty(key) && !propHasKeyProperty && !this.$data.hasOwnProperty(key)) {
4449
Object.defineProperty(this, key, {
4550
get: () => this.$data.$apolloData.data[key],
4651
enumerable: true,

0 commit comments

Comments
 (0)