File tree 2 files changed +12
-5
lines changed
2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -301,6 +301,13 @@ describe('reactivity/reactive', () => {
301
301
expect ( ( ) => markRaw ( obj ) ) . not . toThrowError ( )
302
302
} )
303
303
304
+ test ( 'should not markRaw object as reactive' , ( ) => {
305
+ const a = reactive ( { a : 1 } )
306
+ const b = reactive ( { b : 2 } ) as any
307
+ b . a = markRaw ( toRaw ( a ) )
308
+ expect ( b . a === a ) . toBe ( false )
309
+ } )
310
+
304
311
test ( 'should not observe non-extensible objects' , ( ) => {
305
312
const obj = reactive ( {
306
313
foo : Object . preventExtensions ( { a : 1 } ) ,
Original file line number Diff line number Diff line change @@ -279,16 +279,16 @@ function createReactiveObject(
279
279
) {
280
280
return target
281
281
}
282
- // target already has corresponding Proxy
283
- const existingProxy = proxyMap . get ( target )
284
- if ( existingProxy ) {
285
- return existingProxy
286
- }
287
282
// only specific value types can be observed.
288
283
const targetType = getTargetType ( target )
289
284
if ( targetType === TargetType . INVALID ) {
290
285
return target
291
286
}
287
+ // target already has corresponding Proxy
288
+ const existingProxy = proxyMap . get ( target )
289
+ if ( existingProxy ) {
290
+ return existingProxy
291
+ }
292
292
const proxy = new Proxy (
293
293
target ,
294
294
targetType === TargetType . COLLECTION ? collectionHandlers : baseHandlers ,
You can’t perform that action at this time.
0 commit comments