Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/AI chat: fix an issue
Adorian Doran1bfa7e73b580
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.ts b/apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.tsindex a3835c2cd1..43f2fa7af1 100644--- a/apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.ts+++ b/apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.ts@@ -394,8 +394,10 @@ export function useLlmChat(// Load state from content objectconst loadFromContent = useCallback((content: LlmChatContent) => {- // Opening an existing chat should land on the most recent message.- if ((content.messages?.length ?? 0) > 0) {+ // Opening an existing chat should land on the most recent message — but never+ // clobber a send/retry that has already queued the reply-anchor positioning+ // (a content reload can race the layout effect that consumes the pending mode).+ if ((content.messages?.length ?? 0) > 0 && pendingScrollRef.current !== "anchor") {pendingScrollRef.current = "bottom";}setMessagesInternal(content.messages || []);