From 0ad8e472f7298e50067c3c44525348638d24d535 Mon Sep 17 00:00:00 2001 From: Catherine Renelle <32781029+catrenelle@users.noreply.github.com> Date: Fri, 13 Feb 2026 14:07:09 -0500 Subject: [PATCH] Auto-reload transactions after AI makes changes When the AI updates a category (or any tool result), the transactions page now automatically reloads. ChatPanel triggers a refresh counter in the usePageContext composable when the response includes a tool result, and TransactionsView watches that counter to reload data. Co-Authored-By: Claude Opus 4.6 --- frontend/src/components/chat/ChatPanel.vue | 7 ++++++- frontend/src/composables/usePageContext.ts | 7 ++++++- frontend/src/views/transactions/TransactionsView.vue | 6 +++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/chat/ChatPanel.vue b/frontend/src/components/chat/ChatPanel.vue index eb982df..6301dea 100644 --- a/frontend/src/components/chat/ChatPanel.vue +++ b/frontend/src/components/chat/ChatPanel.vue @@ -145,7 +145,7 @@ import ChatToolResult from '@/views/chat/ChatToolResult.vue' import type { ChatConversation, ChatMessage } from '@/types' const route = useRoute() -const { pageContext } = usePageContext() +const { pageContext, triggerRefresh } = usePageContext() const panelOpen = ref(false) const conversations = ref([]) @@ -280,6 +280,11 @@ async function sendMessage() { } messages.value.push(data.assistantMessage) + + // If the AI used a tool that modified data, tell the page to reload + if (data.assistantMessage.toolResultType) { + triggerRefresh() + } } catch (err: any) { messages.value.push({ id: tempId(), diff --git a/frontend/src/composables/usePageContext.ts b/frontend/src/composables/usePageContext.ts index 943e30d..4079c74 100644 --- a/frontend/src/composables/usePageContext.ts +++ b/frontend/src/composables/usePageContext.ts @@ -1,6 +1,7 @@ import { ref } from 'vue' const pageContext = ref('') +const refreshTrigger = ref(0) export function usePageContext() { function setPageContext(context: string) { @@ -11,5 +12,9 @@ export function usePageContext() { pageContext.value = '' } - return { pageContext, setPageContext, clearPageContext } + function triggerRefresh() { + refreshTrigger.value++ + } + + return { pageContext, setPageContext, clearPageContext, refreshTrigger, triggerRefresh } } diff --git a/frontend/src/views/transactions/TransactionsView.vue b/frontend/src/views/transactions/TransactionsView.vue index 4fbf6e2..e632476 100644 --- a/frontend/src/views/transactions/TransactionsView.vue +++ b/frontend/src/views/transactions/TransactionsView.vue @@ -232,7 +232,11 @@ const startDate = ref('') const endDate = ref('') const statusFilter = ref('All') -const { setPageContext, clearPageContext } = usePageContext() +const { setPageContext, clearPageContext, refreshTrigger } = usePageContext() + +watch(refreshTrigger, () => { + loadTransactions() +}) watchEffect(() => { const filters: string[] = []