Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix(ai-chat): sync local messages when session changes

rcourtmane71951d619f3
diff --git a/frontend-modern/src/components/AI/AIChat.tsx b/frontend-modern/src/components/AI/AIChat.tsx
index c3200d0fb0..d120e264c7 100644
--- a/frontend-modern/src/components/AI/AIChat.tsx
+++ b/frontend-modern/src/components/AI/AIChat.tsx
@@ -315,6 +315,15 @@ export const AIChat: Component<AIChatProps> = (props) => {
}
});
+ // Sync messages from store when session changes (e.g., newConversation, switchSession)
+ // Track sessionId to detect when we need to reload messages from store
+ createEffect(() => {
+ void aiChatStore.sessionId; // Track session changes (creates reactive dependency)
+ // When session changes, sync messages from store to local state
+ const storeMessages = aiChatStore.messages as Message[] || [];
+ setMessagesLocal(storeMessages);
+ });
+
// Auto-send queued message when AI finishes processing
createEffect(() => {
const loading = isLoading();