Skip to content

Commit 2955fd4

Browse files
authored
Merge pull request #117 from tribeti/fix/task-state
fix: save task state
2 parents 6d1cfeb + 0125e58 commit 2955fd4

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/components/project-tabs/TasksTab.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,12 @@ export function TasksTab({ projectId }: { projectId: number }) {
309309
lastLocalWriteRef.current = 0; // Reset on failure
310310
throw new Error();
311311
}
312-
// Don't append newTask to state - wait for Realtime or refetch
313-
// to ensure it has full KanbanTask shape (labels, assignees, etc)
312+
const newTask = await res.json();
313+
// Optimistically add to state with empty relations
314+
setTasks((prev) => {
315+
if (prev.some((t) => t.id === newTask.id)) return prev;
316+
return [...prev, { ...newTask, labels: [], assignees: [], assignee: null }];
317+
});
314318
} catch (insertError) {
315319
console.error(insertError);
316320
error = true;

0 commit comments

Comments
 (0)