Skip to content

Commit

Permalink
setText when user creates new event type
Browse files Browse the repository at this point in the history
  • Loading branch information
kaulfield23 committed Sep 18, 2023
1 parent 5e387af commit 9549204
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/features/events/components/EventTypeAutocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ const EventTypeAutocomplete: FC<EventTypeAutocompleteProps> = ({
//In here, when the length of the type changes,
//it searches for the created event and updates event with an ID.
if (createdType !== '') {
const newId = types.find((item) => item.title === createdType)!.id;
onChangeNewOption(newId!);
const newEventType = types.find((item) => item.title === createdType);
setText(newEventType!.title);
onChangeNewOption(newEventType!.id);
}
}, [types.length]);

Expand Down Expand Up @@ -234,7 +235,7 @@ const EventTypeAutocomplete: FC<EventTypeAutocompleteProps> = ({
? value
: {
id: 'UNCATEGORIZED',
title: text !== '' ? text : uncategorizedMsg,
title: text,
}
}
/>
Expand Down

0 comments on commit 9549204

Please sign in to comment.