Skip to content

Commit 791678a

Browse files
committed
update
1 parent e371162 commit 791678a

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

packages/runtime-core/src/component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,10 @@ export interface ComponentInternalInstance extends GenericComponentInstance {
553553
* Render effect instance
554554
*/
555555
effect: ReactiveEffect
556+
/**
557+
* Force update render effect
558+
*/
559+
update: () => void
556560
/**
557561
* Render effect job to be passed to scheduler (checks if dirty)
558562
*/
@@ -713,6 +717,7 @@ export function createComponentInstance(
713717
next: null,
714718
subTree: null!, // will be set synchronously right after creation
715719
effect: null!,
720+
update: null!, // will be set synchronously right after creation
716721
job: null!,
717722
scope: new EffectScope(true /* detached */),
718723
render: null,

packages/runtime-core/src/componentPublicInstance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ export const publicPropertiesMap: PublicPropertiesMap =
383383
$forceUpdate: i =>
384384
i.f ||
385385
(i.f = () => {
386-
queueJob(() => i.effect.run())
386+
queueJob(i.update)
387387
}),
388388
$nextTick: i => i.n || (i.n = nextTick.bind(i.proxy!)),
389389
$watch: i => (__FEATURE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP),

packages/runtime-core/src/renderer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,6 +1672,7 @@ function baseCreateRenderer(
16721672
namespace,
16731673
optimized,
16741674
))
1675+
instance.update = effect.run.bind(effect)
16751676

16761677
// allowRecurse
16771678
// #1801, #2043 component render effects should allow recursive updates

0 commit comments

Comments
 (0)