This commit is contained in:
Timothy Jaeryang Baek
2026-03-07 17:11:44 -06:00
parent 626fcff417
commit 42ecdb5407
+7 -4
View File
@@ -98,15 +98,18 @@
}); });
const unsubscribeArtifactContents = artifactContents.subscribe((value) => { const unsubscribeArtifactContents = artifactContents.subscribe((value) => {
contents = value; const newContents = value ?? [];
console.log('Artifact contents updated:', contents); console.log('Artifact contents updated:', newContents);
if (contents.length === 0) { if (newContents.length === 0) {
showControls.set(false); showControls.set(false);
showArtifacts.set(false); showArtifacts.set(false);
selectedContentIdx = 0;
} else if (newContents.length > contents.length) {
selectedContentIdx = newContents.length - 1;
} }
selectedContentIdx = contents ? contents.length - 1 : 0; contents = newContents;
}); });
return () => { return () => {