fix(reactivity): ensure computed always expose value
fix #3099 Also changes the original fix for #910 by moving the fix from reactivity to the scheduler
This commit is contained in:
@@ -709,28 +709,6 @@ describe('reactivity/effect', () => {
|
||||
expect(dummy).toBe(3)
|
||||
})
|
||||
|
||||
it('stop with scheduler', () => {
|
||||
let dummy
|
||||
const obj = reactive({ prop: 1 })
|
||||
const queue: (() => void)[] = []
|
||||
const runner = effect(
|
||||
() => {
|
||||
dummy = obj.prop
|
||||
},
|
||||
{
|
||||
scheduler: e => queue.push(e)
|
||||
}
|
||||
)
|
||||
obj.prop = 2
|
||||
expect(dummy).toBe(1)
|
||||
expect(queue.length).toBe(1)
|
||||
stop(runner)
|
||||
|
||||
// a scheduled effect should not execute anymore after stopped
|
||||
queue.forEach(e => e())
|
||||
expect(dummy).toBe(1)
|
||||
})
|
||||
|
||||
it('events: onStop', () => {
|
||||
const onStop = jest.fn()
|
||||
const runner = effect(() => {}, {
|
||||
|
||||
Reference in New Issue
Block a user