File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed
Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -301,6 +301,13 @@ describe('reactivity/reactive', () => {
301301 expect ( ( ) => markRaw ( obj ) ) . not . toThrowError ( )
302302 } )
303303
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+
304311 test ( 'should not observe non-extensible objects' , ( ) => {
305312 const obj = reactive ( {
306313 foo : Object . preventExtensions ( { a : 1 } ) ,
Original file line number Diff line number Diff line change @@ -279,16 +279,16 @@ function createReactiveObject(
279279 ) {
280280 return target
281281 }
282- // target already has corresponding Proxy
283- const existingProxy = proxyMap . get ( target )
284- if ( existingProxy ) {
285- return existingProxy
286- }
287282 // only specific value types can be observed.
288283 const targetType = getTargetType ( target )
289284 if ( targetType === TargetType . INVALID ) {
290285 return target
291286 }
287+ // target already has corresponding Proxy
288+ const existingProxy = proxyMap . get ( target )
289+ if ( existingProxy ) {
290+ return existingProxy
291+ }
292292 const proxy = new Proxy (
293293 target ,
294294 targetType === TargetType . COLLECTION ? collectionHandlers : baseHandlers ,
You can’t perform that action at this time.
0 commit comments