Skip to content

Commit 5170121

Browse files
Algorithm5838github-actions[bot]
authored andcommitted
fix: keep artifact nav index when contents are refreshed
1 parent d21d62c commit 5170121

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/lib/components/chat/Artifacts.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
});
9999
100100
const unsubscribeArtifactContents = artifactContents.subscribe((value) => {
101+
const prevLength = contents.length;
101102
contents = value;
102103
console.log('Artifact contents updated:', contents);
103104
@@ -106,7 +107,9 @@
106107
showArtifacts.set(false);
107108
}
108109
109-
selectedContentIdx = contents ? contents.length - 1 : 0;
110+
if (contents.length > prevLength) {
111+
selectedContentIdx = contents.length - 1;
112+
}
110113
});
111114
112115
return () => {

0 commit comments

Comments
 (0)