From f2ba3e0ac7a8400014b0f3d8e19623a10566c50b Mon Sep 17 00:00:00 2001 From: phyzical Date: Sun, 30 Jan 2022 18:33:04 +0800 Subject: [PATCH] gang member current task disconnect fix * Added check to manually update interal state of dropdown on change of a members task via api --- src/Gang/ui/TaskSelector.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Gang/ui/TaskSelector.tsx b/src/Gang/ui/TaskSelector.tsx index ff19ff550..4c779dc31 100644 --- a/src/Gang/ui/TaskSelector.tsx +++ b/src/Gang/ui/TaskSelector.tsx @@ -21,6 +21,13 @@ export function TaskSelector(props: IProps): React.ReactElement { const gang = useGang(); const [currentTask, setCurrentTask] = useState(props.member.task); + const contextMember = gang.members.find(member => member.name == props.member.name) + if (contextMember && + contextMember.task != currentTask + ) { + setCurrentTask(contextMember.task) + } + function onChange(event: SelectChangeEvent): void { const task = event.target.value; props.member.assignToTask(task);