Skip to content

Commit ca69eba

Browse files
committed
Revert "refactor(runtime-core): pre-refactoring of scheduling rewrite"
This reverts commit 1c8897e.
1 parent c41b78b commit ca69eba

File tree

13 files changed

+232
-261
lines changed

13 files changed

+232
-261
lines changed

packages/reactivity/__tests__/effectScope.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { nextTick, watch, watchEffect } from '@vue/runtime-core'
22
import {
33
type ComputedRef,
44
EffectScope,
5-
ReactiveEffect,
65
computed,
76
effect,
87
effectScope,
@@ -90,7 +89,7 @@ describe('reactivity/effect/scope', () => {
9089
})
9190
})
9291

93-
expect(getEffectsCount(scope)).toBe(1)
92+
expect(getEffectsCount(scope)).toBe(2)
9493
expect(scope.deps?.nextDep?.dep).toBeInstanceOf(EffectScope)
9594

9695
expect(dummy).toBe(0)
@@ -368,7 +367,7 @@ describe('reactivity/effect/scope', () => {
368367
function getEffectsCount(scope: EffectScope): number {
369368
let n = 0
370369
for (let dep = scope.deps; dep !== undefined; dep = dep.nextDep) {
371-
if (dep.dep instanceof ReactiveEffect) {
370+
if ('notify' in dep.dep) {
372371
n++
373372
}
374373
}

packages/reactivity/src/effect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class ReactiveEffect<T = any>
6060
// Subscriber
6161
deps: Link | undefined = undefined
6262
depsTail: Link | undefined = undefined
63-
flags: number = SubscriberFlags.Dirty
63+
flags: number = 0
6464
cleanups: number = 0
6565

6666
// Dependency

packages/reactivity/src/system.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export function propagate(current: Link): void {
151151
const sub = current.sub
152152
const subFlags = sub.flags
153153

154-
let shouldNotify = false
154+
let shouldNotify = 0
155155

156156
if (
157157
!(
@@ -163,23 +163,23 @@ export function propagate(current: Link): void {
163163
)
164164
) {
165165
sub.flags = subFlags | targetFlag
166-
shouldNotify = true
166+
shouldNotify = 1
167167
} else if (
168168
subFlags & SubscriberFlags.Recursed &&
169169
!(subFlags & SubscriberFlags.Tracking)
170170
) {
171171
sub.flags = (subFlags & ~SubscriberFlags.Recursed) | targetFlag
172-
shouldNotify = true
172+
shouldNotify = 1
173173
} else if (
174174
!(subFlags & (SubscriberFlags.Dirty | SubscriberFlags.Pending)) &&
175175
isValidLink(current, sub)
176176
) {
177177
sub.flags = subFlags | SubscriberFlags.Recursed | targetFlag
178-
shouldNotify = !('notify' in sub)
178+
shouldNotify = 2
179179
}
180180

181181
if (shouldNotify) {
182-
if ('notify' in sub) {
182+
if (shouldNotify === 1 && 'notify' in sub) {
183183
notifyBuffer[notifyBufferLength++] = sub
184184
} else {
185185
const subSubs = (sub as Dependency).subs

0 commit comments

Comments
 (0)