fix: Fix memory leaking in Artifacts (#22303)

This commit is contained in:
Shirasawa
2026-03-06 13:49:06 -06:00
committed by GitHub
parent fe58ef69d9
commit b94e1c9458
+7 -2
View File
@@ -90,14 +90,14 @@
};
onMount(() => {
artifactCode.subscribe((value) => {
const unsubscribeArtifactCode = artifactCode.subscribe((value) => {
if (contents) {
const codeIdx = contents.findIndex((content) => content.content.includes(value));
selectedContentIdx = codeIdx !== -1 ? codeIdx : 0;
}
});
artifactContents.subscribe((value) => {
const unsubscribeArtifactContents = artifactContents.subscribe((value) => {
contents = value;
console.log('Artifact contents updated:', contents);
@@ -108,6 +108,11 @@
selectedContentIdx = contents ? contents.length - 1 : 0;
});
return () => {
unsubscribeArtifactCode();
unsubscribeArtifactContents();
};
});
</script>