mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-25 14:57:43 -05:00
fix: Preview on an earlier block opens that block's artifact when the pane was closed (#32688)
This commit is contained in:
1 file changed
+8
-7
@@ -92,13 +92,6 @@
|
||||
};
|
||||
|
||||
onMount(() => {
|
||||
const unsubscribeArtifactCode = artifactCode.subscribe((value) => {
|
||||
if (contents) {
|
||||
const codeIdx = contents.findIndex((content) => content.content.includes(value));
|
||||
selectedContentIdx = codeIdx !== -1 ? codeIdx : 0;
|
||||
}
|
||||
});
|
||||
|
||||
const unsubscribeArtifactContents = artifactContents.subscribe((value) => {
|
||||
const newContents = value ?? [];
|
||||
console.log('Artifact contents updated:', newContents);
|
||||
@@ -116,9 +109,17 @@
|
||||
contents = newContents;
|
||||
});
|
||||
|
||||
const unsubscribeArtifactCode = artifactCode.subscribe((value) => {
|
||||
if (contents && value) {
|
||||
const codeIdx = contents.findIndex((content) => content.content.includes(value));
|
||||
selectedContentIdx = codeIdx !== -1 ? codeIdx : 0;
|
||||
}
|
||||
});
|
||||
|
||||
return () => {
|
||||
unsubscribeArtifactCode();
|
||||
unsubscribeArtifactContents();
|
||||
artifactCode.set(null);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user