Skip to content

Commit fc98351

Browse files
committed
fix(hmr): handle reload for template-only components switching between vapor and vdom
1 parent 9d9efd4 commit fc98351

File tree

1 file changed

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

1 file changed

+2
-1
lines changed

packages/runtime-core/src/hmr.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,14 @@ function reload(id: string, newComp: HMRComponent): void {
117117
if (!record) return
118118

119119
newComp = normalizeClassComponent(newComp)
120+
const isVapor = record.initialDef.__vapor
120121
// update initial def (for not-yet-rendered components)
121122
updateComponentDef(record.initialDef, newComp)
122123

123124
// create a snapshot which avoids the set being mutated during updates
124125
const instances = [...record.instances]
125126

126-
if (newComp.__vapor && !instances.some(i => i.ceReload)) {
127+
if (isVapor && newComp.__vapor && !instances.some(i => i.ceReload)) {
127128
// For multiple instances with the same __hmrId, remove styles first before reload
128129
// to avoid the second instance's style removal deleting the first instance's
129130
// newly added styles (since hmrReload is synchronous)

0 commit comments

Comments
 (0)