fix(reactivity): effect should handle self dependency mutations
This commit is contained in:
@@ -6,7 +6,8 @@ import {
|
||||
TrackOpTypes,
|
||||
TriggerOpTypes,
|
||||
DebuggerEvent,
|
||||
markNonReactive
|
||||
markNonReactive,
|
||||
ref
|
||||
} from '../src/index'
|
||||
import { ITERATE_KEY } from '../src/effect'
|
||||
|
||||
@@ -735,4 +736,14 @@ describe('reactivity/effect', () => {
|
||||
obj.foo = NaN
|
||||
expect(fnSpy).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('should handle self dependency mutations', () => {
|
||||
const count = ref(0)
|
||||
effect(() => {
|
||||
count.value++
|
||||
})
|
||||
expect(count.value).toBe(1)
|
||||
count.value = 10
|
||||
expect(count.value).toBe(11)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user