Skip to content

Commit 7f606e8

Browse files
committed
fix svelte 5 migration error
1 parent c8107c1 commit 7f606e8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

jsEngine/engine/ResultRenderer.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import MessageComponent from 'jsEngine/messages/MessageComponent.svelte';
55
import { type Component } from 'obsidian';
66
import type JsEnginePlugin from 'jsEngine/main';
77
import { ReactiveComponent } from 'jsEngine/api/reactive/ReactiveComponent';
8+
import { mount, unmount } from 'svelte';
89

910
/**
1011
* Attaches to a container and renders values.
@@ -56,7 +57,7 @@ export class ResultRenderer {
5657
}
5758

5859
if (value instanceof MessageWrapper) {
59-
new MessageComponent({
60+
const svelteComponent = mount(MessageComponent, {
6061
target: this.container,
6162
props: {
6263
messageWrapper: value,
@@ -65,6 +66,10 @@ export class ResultRenderer {
6566
showMessageSource: false,
6667
},
6768
});
69+
70+
this.component.register(() => {
71+
unmount(svelteComponent);
72+
})
6873
return;
6974
}
7075

0 commit comments

Comments
 (0)