Skip to content

Commit 231dafd

Browse files
committed
refactor: adjust custom element hmr, fix tests
1 parent bff4ea7 commit 231dafd

File tree

1 file changed

+4
-2
lines changed
  • packages/runtime-core/src

1 file changed

+4
-2
lines changed

packages/runtime-core/src/hmr.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
ClassComponent,
88
isClassComponent
99
} from './component'
10-
import { nextTick, queueJob } from './scheduler'
10+
import { queueJob, queuePostFlushCb } from './scheduler'
1111
import { extend } from '@vue/shared'
1212
import { warn } from './warning'
1313

@@ -124,7 +124,7 @@ function reload(id: string, newComp: ComponentOptions | ClassComponent) {
124124
// on patch.
125125
hmrDirtyComponents.add(component)
126126
// 3. Make sure to unmark the component after the reload.
127-
nextTick(() => {
127+
queuePostFlushCb(() => {
128128
hmrDirtyComponents.delete(component)
129129
})
130130
}
@@ -135,7 +135,9 @@ function reload(id: string, newComp: ComponentOptions | ClassComponent) {
135135

136136
if (instance.ceReload) {
137137
// custom element
138+
hmrDirtyComponents.add(component)
138139
instance.ceReload()
140+
hmrDirtyComponents.delete(component)
139141
} else if (instance.parent) {
140142
// 4. Force the parent instance to re-render. This will cause all updated
141143
// components to be unmounted and re-mounted. Queue the update so that we

0 commit comments

Comments
 (0)