File tree 1 file changed +14
-14
lines changed
1 file changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -60,34 +60,34 @@ function createGetter(isReadonly = false, shallow = false) {
60
60
if ( targetIsArray && hasOwn ( arrayInstrumentations , key ) ) {
61
61
return Reflect . get ( arrayInstrumentations , key , receiver )
62
62
}
63
+
63
64
const res = Reflect . get ( target , key , receiver )
64
65
65
66
if ( ( isSymbol ( key ) && builtInSymbols . has ( key ) ) || key === '__proto__' ) {
66
67
return res
67
68
}
68
69
69
- ! isReadonly && track ( target , TrackOpTypes . GET , key )
70
+ if ( ! isReadonly ) {
71
+ track ( target , TrackOpTypes . GET , key )
72
+ }
70
73
71
74
if ( shallow ) {
72
75
return res
73
76
}
74
77
75
78
if ( isRef ( res ) ) {
76
- if ( targetIsArray ) {
77
- return res
78
- } else {
79
- // ref unwrapping, only for Objects, not for Arrays.
80
- return res . value
81
- }
79
+ // ref unwrapping, only for Objects, not for Arrays.
80
+ return targetIsArray ? res : res . value
81
+ }
82
+
83
+ if ( isObject ( res ) ) {
84
+ // Convert returned value into a proxy as well. we do the isObject check
85
+ // here to avoid invalid value warning. Also need to lazy access readonly
86
+ // and reactive here to avoid circular dependency.
87
+ return isReadonly ? readonly ( res ) : reactive ( res )
82
88
}
83
89
84
- return isObject ( res )
85
- ? isReadonly
86
- ? // need to lazy access readonly and reactive here to avoid
87
- // circular dependency
88
- readonly ( res )
89
- : reactive ( res )
90
- : res
90
+ return res
91
91
}
92
92
}
93
93
You can’t perform that action at this time.
0 commit comments