refactor(enhanced-kanban): simplify task creation event handling

- Updated the event handler in EnhancedKanbanCreateTaskCard to clarify that the form reset is separate from the global task addition to Redux, improving code readability and maintainability.
This commit is contained in:
shancds
2025-07-02 11:41:43 +05:30
parent 382283d0ce
commit 71e1d58ec6

View File

@@ -89,7 +89,7 @@ const EnhancedKanbanCreateTaskCard: React.FC<EnhancedKanbanCreateTaskCardProps>
// Real-time socket event handler
const eventHandler = (task: IProjectTask) => {
dispatch(addTaskToGroup({ sectionId, task: { ...task, id: task.id || nanoid(), name: task.name || newTaskName.trim() } }));
// Only reset the form - the global handler will add the task to Redux
socket?.off(SocketEvents.QUICK_TASK.toString(), eventHandler);
resetForNextTask();
};