Skip to content

Commit 8b18481

Browse files
committed
revert: fix(reactivity): correct dirty assign in render function (#10091)
This reverts commit 8d04205. close #10098 close #10100
1 parent fd337dd commit 8b18481

File tree

2 files changed

+1
-35
lines changed

2 files changed

+1
-35
lines changed

packages/reactivity/__tests__/effect.spec.ts

-32
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,16 @@ import {
33
type ReactiveEffectRunner,
44
TrackOpTypes,
55
TriggerOpTypes,
6-
computed,
76
effect,
87
markRaw,
98
reactive,
109
readonly,
11-
ref,
1210
shallowReactive,
1311
stop,
1412
toRaw,
1513
} from '../src/index'
1614
import { pauseScheduling, resetScheduling } from '../src/effect'
1715
import { ITERATE_KEY, getDepFromReactive } from '../src/reactiveEffect'
18-
import { h, nextTick, nodeOps, render, serialize } from '@vue/runtime-test'
1916

2017
describe('reactivity/effect', () => {
2118
it('should run the passed function once (wrapped by a effect)', () => {
@@ -1014,35 +1011,6 @@ describe('reactivity/effect', () => {
10141011
expect(counterSpy).toHaveBeenCalledTimes(1)
10151012
})
10161013

1017-
// #10082
1018-
it('should set dirtyLevel when effect is allowRecurse and is running', async () => {
1019-
const s = ref(0)
1020-
const n = computed(() => s.value + 1)
1021-
1022-
const Child = {
1023-
setup() {
1024-
s.value++
1025-
return () => n.value
1026-
},
1027-
}
1028-
1029-
const renderSpy = vi.fn()
1030-
const Parent = {
1031-
setup() {
1032-
return () => {
1033-
renderSpy()
1034-
return [n.value, h(Child)]
1035-
}
1036-
},
1037-
}
1038-
1039-
const root = nodeOps.createElement('div')
1040-
render(h(Parent), root)
1041-
await nextTick()
1042-
expect(serialize(root)).toBe('<div>22</div>')
1043-
expect(renderSpy).toHaveBeenCalledTimes(2)
1044-
})
1045-
10461014
describe('empty dep cleanup', () => {
10471015
it('should remove the dep when the effect is stopped', () => {
10481016
const obj = reactive({ prop: 1 })

packages/reactivity/src/effect.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,7 @@ export function triggerEffects(
295295
}
296296
if (
297297
effect._dirtyLevel < dirtyLevel &&
298-
(!effect._runnings ||
299-
effect.allowRecurse ||
300-
dirtyLevel !== DirtyLevels.ComputedValueDirty)
298+
(!effect._runnings || dirtyLevel !== DirtyLevels.ComputedValueDirty)
301299
) {
302300
const lastDirtyLevel = effect._dirtyLevel
303301
effect._dirtyLevel = dirtyLevel

0 commit comments

Comments
 (0)