Skip to content

Commit

Permalink
Fix multiselect for supervisors
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian-emilius committed Sep 26, 2024
1 parent 918753c commit f7530e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions client/src/components/UserMultiSelect/UserMultiSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ const UserMultiSelect = (props: IUserMultiSelectProps) => {
(a, b) => a.value === b.value,
)

useEffect(() => {
if (selected.some((a) => !mergedData.some((b) => a === b.value))) {
setFocused(true)
}
}, [mergedData.map((row) => row.value).join(','), selected.join(',')])

return (
<MultiSelect
data={mergedData}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ const ReplaceTopicModal = (props: ICreateTopicModalProps) => {
required
groups={['supervisor']}
initialUsers={topic?.supervisors}
maxValues={1}
{...form.getInputProps('supervisorIds')}
/>
<UserMultiSelect
Expand Down

0 comments on commit f7530e5

Please sign in to comment.