diff --git a/src/App.test.tsx b/src/App.test.tsx
index 76702206..bedec00c 100644
--- a/src/App.test.tsx
+++ b/src/App.test.tsx
@@ -1,7 +1,8 @@
-import { test, expect } from 'vitest';
+import { render } from '@testing-library/react';
+import { test } from 'vitest';
+
+import App from './App';
test('App', () => {
- // Simple test that just checks the App component can be imported
- // The actual routing and functionality are tested in individual component tests
- expect(true).toBe(true);
-});
\ No newline at end of file
+ render();
+})
\ No newline at end of file
diff --git a/src/components/Shakespeare/ChatPane.tsx b/src/components/Shakespeare/ChatPane.tsx
index 81aa927d..8e63b9c2 100644
--- a/src/components/Shakespeare/ChatPane.tsx
+++ b/src/components/Shakespeare/ChatPane.tsx
@@ -8,7 +8,7 @@ import { useAISettings } from '@/hooks/useAISettings';
import { useFS } from '@/hooks/useFS';
import { useKeepAlive } from '@/hooks/useKeepAlive';
-import { useAIChatSession } from '@/hooks/useAIChatSession';
+import { useAIChat } from '@/hooks/useAIChat';
import type { AIMessage } from '@/lib/SessionManager';
import { ModelSelector } from '@/components/ModelSelector';
@@ -127,7 +127,7 @@ export const ChatPane = forwardRef(({
startGeneration,
stopGeneration,
startNewSession: internalStartNewSession,
- } = useAIChatSession({
+ } = useAIChat({
projectId,
projectName,
tools,
diff --git a/src/hooks/useAIChatSession.ts b/src/hooks/useAIChat.ts
similarity index 99%
rename from src/hooks/useAIChatSession.ts
rename to src/hooks/useAIChat.ts
index 1dc40179..e0506bd0 100644
--- a/src/hooks/useAIChatSession.ts
+++ b/src/hooks/useAIChat.ts
@@ -26,7 +26,7 @@ interface StreamingMessage {
* Hook that provides AI chat functionality using the global session manager.
* Sessions persist and can run in the background when switching between projects.
*/
-export function useAIChatSession({
+export function useAIChat({
projectId,
projectName,
tools = {},
diff --git a/src/hooks/useSessionSubscription.ts b/src/hooks/useSessionSubscription.ts
index 7d13ca06..21859fd3 100644
--- a/src/hooks/useSessionSubscription.ts
+++ b/src/hooks/useSessionSubscription.ts
@@ -1,4 +1,4 @@
-import { useEffect } from 'react';
+import { useEffect, useRef } from 'react';
import { useSessionManager } from './useSessionManager';
import type { SessionManagerEvents } from '@/lib/SessionManager';
@@ -12,11 +12,22 @@ export function useSessionSubscription(
): void {
const sessionManager = useSessionManager();
+ // Use a ref to track the current handler and deps
+ const handlerRef = useRef(handler);
+ const depsRef = useRef(deps);
+
+ // Update refs when handler or deps change
useEffect(() => {
- sessionManager.on(event, handler);
+ handlerRef.current = handler;
+ depsRef.current = deps;
+ }, [handler, deps]);
+
+ useEffect(() => {
+ const currentHandler = handlerRef.current;
+ sessionManager.on(event, currentHandler);
return () => {
- sessionManager.off(event, handler);
+ sessionManager.off(event, currentHandler);
};
- }, [sessionManager, event, handler, ...deps]); // eslint-disable-line react-hooks/exhaustive-deps
+ }, [sessionManager, event]);
}
\ No newline at end of file