* Updates task state in AppState.
( taskId: string, updater: (task: InProcessTeammateTaskState) => InProcessTeammateTaskState, setAppState: SetAppStateFn, )
| 518 | * Updates task state in AppState. |
| 519 | */ |
| 520 | function updateTaskState( |
| 521 | taskId: string, |
| 522 | updater: (task: InProcessTeammateTaskState) => InProcessTeammateTaskState, |
| 523 | setAppState: SetAppStateFn, |
| 524 | ): void { |
| 525 | setAppState(prev => { |
| 526 | const task = prev.tasks[taskId] |
| 527 | if (!task || task.type !== 'in_process_teammate') { |
| 528 | return prev |
| 529 | } |
| 530 | const updated = updater(task) |
| 531 | if (updated === task) { |
| 532 | return prev |
| 533 | } |
| 534 | return { |
| 535 | ...prev, |
| 536 | tasks: { |
| 537 | ...prev.tasks, |
| 538 | [taskId]: updated, |
| 539 | }, |
| 540 | } |
| 541 | }) |
| 542 | } |
| 543 | |
| 544 | /** |
| 545 | * Sends a message to the leader's file-based mailbox. |
no test coverage detected