refactor(reactivity): make some expression simpler (#5131)

This commit is contained in:
zhangenming
2022-05-06 18:42:22 +08:00
committed by GitHub
parent 98b821d94a
commit b9484543db
3 changed files with 14 additions and 12 deletions

View File

@@ -1544,11 +1544,11 @@ function baseCreateRenderer(
// create reactive effect for rendering
const effect = (instance.effect = new ReactiveEffect(
componentUpdateFn,
() => queueJob(instance.update),
() => queueJob(update),
instance.scope // track it in component's effect scope
))
const update = (instance.update = effect.run.bind(effect) as SchedulerJob)
const update: SchedulerJob = (instance.update = () => effect.run())
update.id = instance.uid
// allowRecurse
// #1801, #2043 component render effects should allow recursive updates
@@ -1561,7 +1561,6 @@ function baseCreateRenderer(
effect.onTrigger = instance.rtg
? e => invokeArrayFns(instance.rtg!, e)
: void 0
// @ts-ignore (for scheduler)
update.ownerInstance = instance
}