Skip artifact clear when re-selecting the same thread
Only clear artifact store when navigating to a different thread, not when clicking the already-active thread in the sidebar.
This commit is contained in:
parent
a30c7789da
commit
1bfcfc9745
1 changed files with 8 additions and 2 deletions
|
|
@ -596,8 +596,14 @@ export function ChatPage(): ReactElement {
|
|||
|
||||
const handleThreadSelect = useCallback(
|
||||
(nextView: ChatView) => {
|
||||
useArtifactStore.getState().clearArtifacts();
|
||||
setView(nextView);
|
||||
setView((prev) => {
|
||||
const prevId = prev.mode === "single" ? prev.threadId : prev.pairId;
|
||||
const nextId = nextView.mode === "single" ? nextView.threadId : nextView.pairId;
|
||||
if (prevId !== nextId) {
|
||||
useArtifactStore.getState().clearArtifacts();
|
||||
}
|
||||
return nextView;
|
||||
});
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue