mirror of
https://github.com/coleam00/Archon.git
synced 2026-01-02 04:39:29 -05:00
Fixing task socket issues when adding tasks in task table.
This commit is contained in:
@@ -98,7 +98,7 @@ export function useTaskSocket(options: UseTaskSocketOptions) {
|
||||
return () => {
|
||||
clearInterval(interval);
|
||||
};
|
||||
}, [onConnectionStateChange, memoizedHandlers]);
|
||||
}, []); // No dependencies - only run once on mount
|
||||
|
||||
// Initialize connection once and register handlers
|
||||
useEffect(() => {
|
||||
@@ -132,15 +132,7 @@ export function useTaskSocket(options: UseTaskSocketOptions) {
|
||||
|
||||
initializeConnection();
|
||||
|
||||
}, [projectId, memoizedHandlers]);
|
||||
|
||||
// Update handlers when they change (without reconnecting)
|
||||
useEffect(() => {
|
||||
if (isInitializedRef.current && currentProjectIdRef.current === projectId) {
|
||||
console.log(`[USE_TASK_SOCKET] Updating handlers for component: ${componentIdRef.current}`);
|
||||
taskSocketService.registerHandlers(componentIdRef.current, memoizedHandlers());
|
||||
}
|
||||
}, [memoizedHandlers, projectId]);
|
||||
}, [projectId]); // Only depend on projectId
|
||||
|
||||
// Handle project change (different project)
|
||||
useEffect(() => {
|
||||
@@ -176,7 +168,7 @@ export function useTaskSocket(options: UseTaskSocketOptions) {
|
||||
|
||||
switchProject();
|
||||
}
|
||||
}, [projectId, memoizedHandlers]);
|
||||
}, [projectId]); // Only depend on projectId
|
||||
|
||||
// Cleanup on unmount
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user