Skip to content

Commit bf068ce

Browse files
author
Guillaume Chau
committed
Revert this.$apollo
1 parent be21682 commit bf068ce

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const prepare = function prepare () {
2424
if (apollo) {
2525
this._apolloQueries = {}
2626
this._apolloInitData = {}
27-
this.$apollo = new DollarApollo(this)
2827

2928
if (!apollo.$init) {
3029
apollo.$init = true
@@ -114,6 +113,16 @@ export function install (Vue, options) {
114113
return Object.assign(map, merge(toData, fromData))
115114
}
116115

116+
// Lazy creation
117+
Object.defineProperty(Vue.prototype, '$apollo', {
118+
get () {
119+
if (!this._apollo) {
120+
this._apollo = new DollarApollo(this)
121+
}
122+
return this._apollo
123+
},
124+
})
125+
117126
Vue.mixin({
118127

119128
// Vue 1.x

0 commit comments

Comments
 (0)