mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
Emergency fix: Disable setChat calls to stop infinite loops
- Temporarily disable setChat useEffect in BaseChat2 - Simplify handleSetChat in TabbedChatContainer - This should restore basic chat functionality while we fix tab persistence properly
This commit is contained in:
@@ -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 : '';
|
||||
|
||||
|
||||
@@ -122,28 +122,11 @@ export const TabbedChatContainer: React.FC<TabbedChatContainerProps> = ({
|
||||
}
|
||||
}, [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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user