Skip to content

Commit

Permalink
fix: set default filter and use onSelect for dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
pkulkark committed Sep 6, 2024
1 parent 33b5897 commit 9ceb989
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ const CoursesFilterMenu = ({
if (cleanFilters) {
setItemMenuSelected(defaultItemSelectedText);
}
const defaultItem = menuItems.find(item => item.name === defaultItemSelectedText);
if (defaultItem) {
onItemMenuSelected(defaultItem.value);
}
}, [cleanFilters]);

return (
Expand All @@ -43,7 +47,7 @@ const CoursesFilterMenu = ({
{menuItems.map(({ id, name, value }) => (
<Dropdown.Item
key={id}
onClick={() => handleCourseTypeSelected(name, value)}
onSelect={() => handleCourseTypeSelected(name, value)}
data-testid={`item-menu-${id}`}
>
{name} {courseTypeSelectedIcon(name)}
Expand Down

0 comments on commit 9ceb989

Please sign in to comment.