Skip to content

Commit 78d56d1

Browse files
committed
refactor(runtime-core): enhance SetupRenderEffect to manage job scheduling more effectively
1 parent 5576e9f commit 78d56d1

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

packages/runtime-core/src/renderer.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,8 @@ function baseCreateRenderer(
13261326
}
13271327

13281328
class SetupRenderEffect extends ReactiveEffect {
1329+
job: SchedulerJob
1330+
13291331
constructor(
13301332
private instance: ComponentInternalInstance,
13311333
private initialVNode: VNode,
@@ -1339,9 +1341,12 @@ function baseCreateRenderer(
13391341
super()
13401342
setCurrentScope(prevScope)
13411343

1342-
const job: SchedulerJob = (instance.job = this.scheduler.bind(this))
1343-
job.i = instance
1344-
this.scheduler = () => queueJob(job, instance.uid)
1344+
this.job = instance.job = () => {
1345+
if (this.dirty) {
1346+
this.run()
1347+
}
1348+
}
1349+
this.job.i = instance
13451350

13461351
if (__DEV__) {
13471352
this.onTrack = instance.rtc
@@ -1353,6 +1358,11 @@ function baseCreateRenderer(
13531358
}
13541359
}
13551360

1361+
scheduler() {
1362+
const job = this.job
1363+
queueJob(job, job.i!.uid)
1364+
}
1365+
13561366
fn() {
13571367
const {
13581368
instance,

0 commit comments

Comments
 (0)