Skip to content

Commit

Permalink
fix(ui): prevent false duplicates on group form updates
Browse files Browse the repository at this point in the history
  • Loading branch information
hdinia committed Apr 3, 2024
1 parent 86c8b31 commit 5a0772b
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ function GroupForm(props: UseFormReturnPlus) {
);
}, [users, authUser]);

// !NOTE: the current group value is tracked to avoid a false duplicates.
// Because this component handles both creation and update, it should be splitted.
const editedGroup = defaultValues?.name || undefined;

////////////////////////////////////////////////////////////////
// Event Handlers
////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -115,6 +119,7 @@ function GroupForm(props: UseFormReturnPlus) {
validateString(v, {
existingValues: existingGroups,
excludedValues: RESERVED_GROUP_NAMES,
editedValue: editedGroup,
}),
})}
/>
Expand Down

0 comments on commit 5a0772b

Please sign in to comment.