Merge pull request #2878 from phyzical/bugfix/fix-ui-gang-member-task

Fix for ui of gang members current task when set via api
This commit is contained in:
hydroflame 2022-03-20 14:25:23 -04:00 committed by GitHub
commit b295dd084d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -21,6 +21,13 @@ export function TaskSelector(props: IProps): React.ReactElement {
const gang = useGang(); const gang = useGang();
const [currentTask, setCurrentTask] = useState(props.member.task); 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 { function onChange(event: SelectChangeEvent<string>): void {
const task = event.target.value; const task = event.target.value;
props.member.assignToTask(task); props.member.assignToTask(task);