Skip to content

Commit

Permalink
🐛 Tag categories sort logic in form select (#1455)
Browse files Browse the repository at this point in the history
https://issues.redhat.com/browse/MTA-1379

Signed-off-by: ibolton336 <ibolton@redhat.com>
  • Loading branch information
ibolton336 authored Oct 11, 2023
1 parent 82de730 commit 29b8ac0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions client/src/app/pages/controls/tags/components/tag-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ export const TagForm: React.FC<TagFormProps> = ({ tag, onClose }) => {

const { tagCategories } = useFetchTagCategories();

const tagCategoryOptions = tagCategories.map((tagCategory: TagCategory) => {
return {
value: tagCategory.name,
toString: () => tagCategory.name,
};
});
const tagCategoryOptions = useMemo(() => {
const options = tagCategories.map((tagCategory: TagCategory) => {
return {
value: tagCategory.name,
toString: () => tagCategory.name,
};
});

return options.sort((a, b) => a.value.localeCompare(b.value));
}, [tagCategories]);

const tagCategoryInitialValue: ITagCategoryDropdown | null = useMemo(() => {
const matchingTagCategory = tagCategories
Expand Down

0 comments on commit 29b8ac0

Please sign in to comment.