Skip to content

Commit

Permalink
chore: v3.0.0-beta.30
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed May 21, 2019
1 parent 6817321 commit d841455
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 24 deletions.
43 changes: 32 additions & 11 deletions dist/vue-apollo.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -743,10 +743,12 @@ function (_SmartApollo) {

_defineProperty(_assertThisInitialized(_this), "_loading", false);

_this.firstRun = new Promise(function (resolve, reject) {
_this._firstRunResolve = resolve;
_this._firstRunReject = reject;
});
if (vm.$isServer) {
_this.firstRun = new Promise(function (resolve, reject) {
_this._firstRunResolve = resolve;
_this._firstRunReject = reject;
});
}

if (_this.vm.$isServer) {
_this.options.fetchPolicy = 'network-only';
Expand Down Expand Up @@ -1044,9 +1046,9 @@ function (_SmartApollo) {
}
}, {
key: "firstRunReject",
value: function firstRunReject() {
value: function firstRunReject(error) {
if (this._firstRunReject) {
this._firstRunReject();
this._firstRunReject(error);

this._firstRunReject = null;
}
Expand Down Expand Up @@ -4596,6 +4598,12 @@ var CApolloQuery = {
type: Object,
"default": undefined
},
update: {
type: Function,
"default": function _default(data) {
return data;
}
},
skip: {
type: Boolean,
"default": false
Expand Down Expand Up @@ -4651,6 +4659,9 @@ var CApolloQuery = {
this.$apollo.queries.query.setOptions({
notifyOnNetworkStatusChange: value
});
},
'$data.$apolloData.loading': function $data$apolloDataLoading(value) {
this.$emit('loading', !!value);
}
},
apollo: {
Expand Down Expand Up @@ -4708,8 +4719,10 @@ var CApolloQuery = {
this.$_previousData = _result.data;
}

var dataNotEmpty = isDataFilled(data);
this.result = {
data: isDataFilled(data) ? data : undefined,
data: dataNotEmpty ? this.update(data) : undefined,
fullData: dataNotEmpty ? data : undefined,
loading: loading,
error: error,
networkStatus: networkStatus
Expand Down Expand Up @@ -4850,6 +4863,11 @@ var CApolloMutation = {
error: null
};
},
watch: {
loading: function loading(value) {
this.$emit('loading', value);
}
},
methods: {
mutate: function mutate(options) {
var _this = this;
Expand Down Expand Up @@ -4999,10 +5017,13 @@ function launch() {
if (key.charAt(0) !== '$') {
var options = apollo[key];
var smart = this.$apollo.addSmartQuery(key, options);
options = utils_5(options, this);

if (options.prefetch !== false && apollo.$prefetch !== false && !smart.skip) {
this.$_apolloPromises.push(smart.firstRun);
if (this.$isServer) {
options = utils_5(options, this);

if (options.prefetch !== false && apollo.$prefetch !== false && !smart.skip) {
this.$_apolloPromises.push(smart.firstRun);
}
}
}
}
Expand Down Expand Up @@ -5111,7 +5132,7 @@ function install(Vue, options) {
}
ApolloProvider.install = install; // eslint-disable-next-line no-undef

ApolloProvider.version = "3.0.0-beta.29"; // Apollo provider
ApolloProvider.version = "3.0.0-beta.30"; // Apollo provider

var ApolloProvider$1 = ApolloProvider; // Components

Expand Down
2 changes: 1 addition & 1 deletion dist/vue-apollo.min.js

Large diffs are not rendered by default.

43 changes: 32 additions & 11 deletions dist/vue-apollo.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -749,10 +749,12 @@

_defineProperty(_assertThisInitialized(_this), "_loading", false);

_this.firstRun = new Promise(function (resolve, reject) {
_this._firstRunResolve = resolve;
_this._firstRunReject = reject;
});
if (vm.$isServer) {
_this.firstRun = new Promise(function (resolve, reject) {
_this._firstRunResolve = resolve;
_this._firstRunReject = reject;
});
}

if (_this.vm.$isServer) {
_this.options.fetchPolicy = 'network-only';
Expand Down Expand Up @@ -1050,9 +1052,9 @@
}
}, {
key: "firstRunReject",
value: function firstRunReject() {
value: function firstRunReject(error) {
if (this._firstRunReject) {
this._firstRunReject();
this._firstRunReject(error);

this._firstRunReject = null;
}
Expand Down Expand Up @@ -4602,6 +4604,12 @@
type: Object,
"default": undefined
},
update: {
type: Function,
"default": function _default(data) {
return data;
}
},
skip: {
type: Boolean,
"default": false
Expand Down Expand Up @@ -4657,6 +4665,9 @@
this.$apollo.queries.query.setOptions({
notifyOnNetworkStatusChange: value
});
},
'$data.$apolloData.loading': function $data$apolloDataLoading(value) {
this.$emit('loading', !!value);
}
},
apollo: {
Expand Down Expand Up @@ -4714,8 +4725,10 @@
this.$_previousData = _result.data;
}

var dataNotEmpty = isDataFilled(data);
this.result = {
data: isDataFilled(data) ? data : undefined,
data: dataNotEmpty ? this.update(data) : undefined,
fullData: dataNotEmpty ? data : undefined,
loading: loading,
error: error,
networkStatus: networkStatus
Expand Down Expand Up @@ -4856,6 +4869,11 @@
error: null
};
},
watch: {
loading: function loading(value) {
this.$emit('loading', value);
}
},
methods: {
mutate: function mutate(options) {
var _this = this;
Expand Down Expand Up @@ -5005,10 +5023,13 @@
if (key.charAt(0) !== '$') {
var options = apollo[key];
var smart = this.$apollo.addSmartQuery(key, options);
options = utils_5(options, this);

if (options.prefetch !== false && apollo.$prefetch !== false && !smart.skip) {
this.$_apolloPromises.push(smart.firstRun);
if (this.$isServer) {
options = utils_5(options, this);

if (options.prefetch !== false && apollo.$prefetch !== false && !smart.skip) {
this.$_apolloPromises.push(smart.firstRun);
}
}
}
}
Expand Down Expand Up @@ -5117,7 +5138,7 @@
}
ApolloProvider.install = install; // eslint-disable-next-line no-undef

ApolloProvider.version = "3.0.0-beta.29"; // Apollo provider
ApolloProvider.version = "3.0.0-beta.30"; // Apollo provider

var ApolloProvider$1 = ApolloProvider; // Components

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-apollo",
"version": "3.0.0-beta.29",
"version": "3.0.0-beta.30",
"description": "Use Apollo and GraphQL with Vue.js",
"main": "dist/vue-apollo.umd.js",
"module": "dist/vue-apollo.esm.js",
Expand Down

0 comments on commit d841455

Please sign in to comment.