@@ -6,30 +6,6 @@ function hasProperty (holder, key) {
66 return typeof holder !== 'undefined' && Object . prototype . hasOwnProperty . call ( holder , key )
77}
88
9- function proxyData ( ) {
10- this . $_apolloInitData = { }
11-
12- const apollo = this . $options . apollo
13- if ( apollo ) {
14- // watchQuery
15- for ( const key in apollo ) {
16- if ( key . charAt ( 0 ) !== '$' ) {
17- const options = apollo [ key ]
18- // Property proxy
19- if ( ! options . manual && ! hasProperty ( this . $options . props , key ) && ! hasProperty ( this . $options . computed , key ) && ! hasProperty ( this . $options . methods , key ) ) {
20- Object . defineProperty ( this , key , {
21- get : ( ) => this . $data . $apolloData . data [ key ] ,
22- // For component class constructor
23- set : value => this . $_apolloInitData [ key ] = value ,
24- enumerable : true ,
25- configurable : true ,
26- } )
27- }
28- }
29- }
30- }
31- }
32-
339function launch ( ) {
3410 const apolloProvider = this . $apolloProvider
3511
@@ -112,18 +88,30 @@ function destroy () {
11288export function installMixin ( app , provider ) {
11389 app . mixin ( {
11490 data ( ) {
115- return {
91+ const result = {
11692 $apolloData : {
11793 queries : { } ,
11894 loading : 0 ,
119- data : this . $_apolloInitData ,
95+ data : { } ,
12096 } ,
12197 }
98+ // Init data props
99+ const apollo = this . $options . apollo
100+ if ( apollo ) {
101+ for ( const key in apollo ) {
102+ if ( key . charAt ( 0 ) !== '$' ) {
103+ const options = apollo [ key ]
104+ if ( ! options . manual && ! hasProperty ( this . $options . props , key ) && ! hasProperty ( this . $options . computed , key ) && ! hasProperty ( this . $options . methods , key ) ) {
105+ result [ key ] = null
106+ }
107+ }
108+ }
109+ }
110+ return result
122111 } ,
123112
124113 beforeCreate ( ) {
125114 this . $apollo = new DollarApollo ( this , provider )
126- proxyData . call ( this )
127115 if ( isServer ) {
128116 // Patch render function to cleanup apollo
129117 const render = this . $options . render
0 commit comments