fix(webui): navigate from history to unsaved live prompts

This commit is contained in:
Xubin Ren committed 2026-10-18 17:13:18 +08:00
1 parent f9a3e55b64
commit f230409b5a
2 files changed
+19 -3

No files matched your search

@@ -534,13 +534,15 @@ export const ThreadViewport = forwardRef<ThreadViewportHandle, ThreadViewportPro
navigation.jump(promptId);
return;
}
const index = messages.findIndex((message) => message.id === promptId);
const localMessages = historyWindow ? latestMessages : messages;
const index = localMessages.findIndex((message) => message.id === promptId);
if (index < 0) return;
if (historyWindow) navigation?.latest();
threadMotionRef.current?.takeUserControl();
pendingPromptJumpRef.current = promptId;
setAtBottom(false);
setVisibleMessageCount((count) => Math.max(count, messages.length - index));
}, [messages, navigateToVisiblePrompt, navigation]);
setVisibleMessageCount((count) => Math.max(count, localMessages.length - index));
}, [historyWindow, latestMessages, messages, navigateToVisiblePrompt, navigation]);
useLayoutEffect(() => {
if (!navigation?.target) return;