From 7c49aaadefee89a348227e5828748c1f95489160 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Mon, 14 Apr 2025 14:08:21 -0600 Subject: [PATCH] auto select update for files --- web/src/layouts/ChatLayout/ChatContext/ChatContext.tsx | 2 ++ .../ChatLayout/ChatContext/useAutoChangeLayout.ts | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/web/src/layouts/ChatLayout/ChatContext/ChatContext.tsx b/web/src/layouts/ChatLayout/ChatContext/ChatContext.tsx index dc62599b0..b66a289d0 100644 --- a/web/src/layouts/ChatLayout/ChatContext/ChatContext.tsx +++ b/web/src/layouts/ChatLayout/ChatContext/ChatContext.tsx @@ -94,6 +94,8 @@ export const ChatContextProvider = React.memo(({ children }: PropsWithChildren<{ onSetSelectedFile }); + console.log(selectedFile); + return ( {children} diff --git a/web/src/layouts/ChatLayout/ChatContext/useAutoChangeLayout.ts b/web/src/layouts/ChatLayout/ChatContext/useAutoChangeLayout.ts index 65b1f7600..e71b3b08b 100644 --- a/web/src/layouts/ChatLayout/ChatContext/useAutoChangeLayout.ts +++ b/web/src/layouts/ChatLayout/ChatContext/useAutoChangeLayout.ts @@ -128,9 +128,8 @@ export const useAutoChangeLayout = ({ message.type === 'file' && message.file_type === 'dashboard' && message.id === dashboardId; - if (isFile) { - return message; - } + if (isFile) return message; + return acc; }, undefined); @@ -158,9 +157,8 @@ export const useAutoChangeLayout = ({ const message = chatMessage?.response_messages[messageId]!; const isFile = message.type === 'file' && message.file_type === 'metric' && message.id === metricId; - if (isFile) { - return message; - } + if (isFile) return message; + return acc; }, undefined);