Skip to content

Commit 7743b9e

Browse files
committed
fix: fixed domIf
1 parent d194f62 commit 7743b9e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

packages/runtime-core/src/core/render/schema.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,14 @@ export default class DomilyRenderSchema<
446446
this.__dom?.appendChild(nextMappedListFragment);
447447
}
448448

449+
gatherInternalEffectAborts(gatherArray: (() => void)[]) {
450+
for (const abort of this._internalEffectAborts) {
451+
if (isFunction(abort)) {
452+
gatherArray.push(abort);
453+
}
454+
}
455+
}
456+
449457
abortEffect() {
450458
for (const abort of this._internalEffectAborts) {
451459
isFunction(abort) && abort();
@@ -513,6 +521,9 @@ export default class DomilyRenderSchema<
513521
if (previousDomIf === nextDomIf) {
514522
return;
515523
}
524+
if (!this.__dom?.isConnected) {
525+
return;
526+
}
516527
if (!nextDomIf) {
517528
this.__dom = this.domInterrupter(replaceDOM(this.__dom, c("dom-if")));
518529
} else {

packages/runtime-core/src/core/render/shared/parse.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,5 +222,9 @@ export function domilyChildToDOM(
222222
gatherChildLifeCycleQueue.push(lifecycle);
223223
}
224224

225+
if (Array.isArray(gatherEffectAborts)) {
226+
childSchema.gatherInternalEffectAborts(gatherEffectAborts);
227+
}
228+
225229
return dom;
226230
}

0 commit comments

Comments
 (0)