From 9ceb989675505e9216ccea11ff8b1a6fc406cc35 Mon Sep 17 00:00:00 2001 From: Pooja Kulkarni Date: Fri, 6 Sep 2024 11:35:36 -0400 Subject: [PATCH] fix: set default filter and use onSelect for dropdown --- .../courses-filters/courses-filter-menu/index.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/studio-home/tabs-section/courses-tab/courses-filters/courses-filter-menu/index.jsx b/src/studio-home/tabs-section/courses-tab/courses-filters/courses-filter-menu/index.jsx index 9843b65330..b1afafbdae 100644 --- a/src/studio-home/tabs-section/courses-tab/courses-filters/courses-filter-menu/index.jsx +++ b/src/studio-home/tabs-section/courses-tab/courses-filters/courses-filter-menu/index.jsx @@ -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 ( @@ -43,7 +47,7 @@ const CoursesFilterMenu = ({ {menuItems.map(({ id, name, value }) => ( handleCourseTypeSelected(name, value)} + onSelect={() => handleCourseTypeSelected(name, value)} data-testid={`item-menu-${id}`} > {name} {courseTypeSelectedIcon(name)}