fix(reactivity): ensure that shallow and normal proxies are tracked seperately (close #2843) (#2851)
fix #2843
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { shallowReactive, isReactive, reactive } from '../src/reactive'
|
||||
import { isReactive, reactive, shallowReactive } from '../src/reactive'
|
||||
|
||||
import { effect } from '../src/effect'
|
||||
|
||||
describe('shallowReactive', () => {
|
||||
@@ -13,6 +14,16 @@ describe('shallowReactive', () => {
|
||||
expect(isReactive(props.n)).toBe(true)
|
||||
})
|
||||
|
||||
// #2843
|
||||
test('should allow shallow und normal reactive for same target', async () => {
|
||||
const original = { foo: {} }
|
||||
const shallowProxy = shallowReactive(original)
|
||||
const reactiveProxy = reactive(original)
|
||||
expect(shallowProxy).not.toBe(reactiveProxy)
|
||||
expect(isReactive(shallowProxy.foo)).toBe(false)
|
||||
expect(isReactive(reactiveProxy.foo)).toBe(true)
|
||||
})
|
||||
|
||||
describe('collections', () => {
|
||||
test('should be reactive', () => {
|
||||
const shallowSet = shallowReactive(new Set())
|
||||
|
||||
Reference in New Issue
Block a user