mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-28 06:22:33 +00:00
fix: Preview on an earlier block opens that block's artifact when the pane was closed (#32688)
This commit is contained in:
parent
a944564c20
commit
9862a5bd61
1 changed files with 8 additions and 7 deletions
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue