diff --git a/ui/desktop/src/components/BaseChat2.tsx b/ui/desktop/src/components/BaseChat2.tsx index 1b3d4426ec..f8896a255b 100644 --- a/ui/desktop/src/components/BaseChat2.tsx +++ b/ui/desktop/src/components/BaseChat2.tsx @@ -323,10 +323,11 @@ function BaseChatContent({ title: session?.description || (messages.length > 0 ? 'Chat' : 'New Chat'), }), [messages, recipe, session?.id, sessionId, session?.name, session?.description]); + // TODO: Re-enable this once we fix the infinite loop issue // Update parent with chat state whenever it changes - useEffect(() => { - setChat(chat); - }, [setChat, chat]); + // useEffect(() => { + // setChat(chat); + // }, [setChat, chat]); const initialPrompt = messages.length == 0 && recipe?.prompt ? recipe.prompt : ''; diff --git a/ui/desktop/src/components/TabbedChatContainer.tsx b/ui/desktop/src/components/TabbedChatContainer.tsx index b43a5fd5fa..0da6a904fd 100644 --- a/ui/desktop/src/components/TabbedChatContainer.tsx +++ b/ui/desktop/src/components/TabbedChatContainer.tsx @@ -122,28 +122,11 @@ export const TabbedChatContainer: React.FC = ({ } }, [tabStates, updateSessionId]); - // Memoize the setChat callback to prevent infinite re-renders + // Temporarily simplified setChat to prevent infinite loops const handleSetChat = useCallback((chat: any) => { - const currentActiveTabState = getActiveTabState(); - if (!currentActiveTabState) return; - - // Handle session ID updates - if (chat.sessionId && chat.sessionId !== currentActiveTabState.tab.sessionId) { - handleSessionUpdate(chat.sessionId, currentActiveTabState.tab.id); - } - - // Only update if the chat has actually changed - const currentChat = currentActiveTabState.chat; - const hasChanged = - chat.sessionId !== currentChat.sessionId || - chat.messages.length !== currentChat.messages.length || - chat.title !== currentChat.title || - chat.name !== currentChat.name; - - if (hasChanged) { - handleChatUpdate(currentActiveTabState.tab.id, chat); - } - }, [getActiveTabState, handleSessionUpdate, handleChatUpdate]); + // TODO: Re-implement proper tab state updates once infinite loop is fixed + console.log('setChat called but temporarily disabled to prevent infinite loops'); + }, []); const activeTabState = getActiveTabState();