gang member current task disconnect fix

* Added check to manually update interal state of dropdown on change of a members task via api
This commit is contained in:
phyzical 2022-01-30 18:33:04 +08:00
parent 9294ff3e9e
commit f2ba3e0ac7

@ -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<string>): void {
const task = event.target.value;
props.member.assignToTask(task);