File tree Expand file tree Collapse file tree 2 files changed +5
-12
lines changed Expand file tree Collapse file tree 2 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { extend, hasChanged } from '@vue/shared'
22import type { ComputedRefImpl } from './computed'
33import type { TrackOpTypes , TriggerOpTypes } from './constants'
44import { type Dep , globalVersion } from './dep'
5- import { recordEffectScope } from './effectScope'
5+ import { activeEffectScope } from './effectScope'
66import { warn } from './warning'
77
88export type EffectScheduler = ( ...args : any [ ] ) => any
@@ -137,7 +137,9 @@ export class ReactiveEffect<T = any>
137137 onTrigger ?: ( event : DebuggerEvent ) => void
138138
139139 constructor ( public fn : ( ) => T ) {
140- recordEffectScope ( this )
140+ if ( activeEffectScope && activeEffectScope . active ) {
141+ activeEffectScope . effects . push ( this )
142+ }
141143 }
142144
143145 /**
Original file line number Diff line number Diff line change 11import type { ReactiveEffect } from './effect'
22import { warn } from './warning'
33
4- let activeEffectScope : EffectScope | undefined
4+ export let activeEffectScope : EffectScope | undefined
55
66export class EffectScope {
77 /**
@@ -120,15 +120,6 @@ export function effectScope(detached?: boolean) {
120120 return new EffectScope ( detached )
121121}
122122
123- export function recordEffectScope (
124- effect : ReactiveEffect ,
125- scope : EffectScope | undefined = activeEffectScope ,
126- ) {
127- if ( scope && scope . active ) {
128- scope . effects . push ( effect )
129- }
130- }
131-
132123/**
133124 * Returns the current active effect scope if there is one.
134125 *
You can’t perform that action at this time.
0 commit comments