Skip to content

Commit

Permalink
refactor(reactive): remove unnecessary args handling in reactiveEffect (
Browse files Browse the repository at this point in the history
  • Loading branch information
Zardddddd60 committed Jul 16, 2020
1 parent 22973b4 commit ecf872f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/reactivity/src/effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type KeyToDepMap = Map<any, Dep>
const targetMap = new WeakMap<any, KeyToDepMap>()

export interface ReactiveEffect<T = any> {
(...args: any[]): T
(): T
_isEffect: true
id: number
active: boolean
Expand Down Expand Up @@ -77,20 +77,20 @@ export function stop(effect: ReactiveEffect) {
let uid = 0

function createReactiveEffect<T = any>(
fn: (...args: any[]) => T,
fn: () => T,
options: ReactiveEffectOptions
): ReactiveEffect<T> {
const effect = function reactiveEffect(...args: unknown[]): unknown {
const effect = function reactiveEffect(): unknown {
if (!effect.active) {
return options.scheduler ? undefined : fn(...args)
return options.scheduler ? undefined : fn()
}
if (!effectStack.includes(effect)) {
cleanup(effect)
try {
enableTracking()
effectStack.push(effect)
activeEffect = effect
return fn(...args)
return fn()
} finally {
effectStack.pop()
resetTracking()
Expand Down

0 comments on commit ecf872f

Please sign in to comment.