From fa800c95ab4ec3204605d266027194fa62b6d048 Mon Sep 17 00:00:00 2001 From: Pooja Kulkarni Date: Mon, 9 Sep 2024 10:34:36 -0400 Subject: [PATCH] fix: only set default for coursetypes filter --- .../courses-filters/courses-filter-menu/index.jsx | 6 ++++++ .../courses-filters/courses-order-filter-menu/index.jsx | 1 + .../courses-filters/courses-types-filter-menu/index.jsx | 1 + 3 files changed, 8 insertions(+) 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 b1afafbdae..edd969d662 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 @@ -10,6 +10,7 @@ const CoursesFilterMenu = ({ menuItems, onItemMenuSelected, defaultItemSelectedText, + menuType, }) => { const [itemMenuSelected, setItemMenuSelected] = useState(defaultItemSelectedText); const { cleanFilters } = useSelector(getStudioHomeCoursesParams); @@ -26,6 +27,9 @@ const CoursesFilterMenu = ({ if (cleanFilters) { setItemMenuSelected(defaultItemSelectedText); } + if (menuType !== 'courseTypes') { + return; + } const defaultItem = menuItems.find(item => item.name === defaultItemSelectedText); if (defaultItem) { onItemMenuSelected(defaultItem.value); @@ -61,6 +65,7 @@ const CoursesFilterMenu = ({ CoursesFilterMenu.defaultProps = { defaultItemSelectedText: '', menuItems: [], + menuType: '', }; CoursesFilterMenu.propTypes = { @@ -74,6 +79,7 @@ CoursesFilterMenu.propTypes = { value: PropTypes.string.isRequired, }), ), + menuType: PropTypes.string, }; export default CoursesFilterMenu; diff --git a/src/studio-home/tabs-section/courses-tab/courses-filters/courses-order-filter-menu/index.jsx b/src/studio-home/tabs-section/courses-tab/courses-filters/courses-order-filter-menu/index.jsx index 837d11dca9..3c02fa55c9 100644 --- a/src/studio-home/tabs-section/courses-tab/courses-filters/courses-order-filter-menu/index.jsx +++ b/src/studio-home/tabs-section/courses-tab/courses-filters/courses-order-filter-menu/index.jsx @@ -45,6 +45,7 @@ const CoursesOrderFilterMenu = ({ onItemMenuSelected }) => { menuItems={courseOrders} onItemMenuSelected={handleCourseTypeSelected} defaultItemSelectedText={intl.formatMessage(messages.coursesOrderFilterMenuAscendantCurses)} + menuType="courseOrders" /> ); }; diff --git a/src/studio-home/tabs-section/courses-tab/courses-filters/courses-types-filter-menu/index.jsx b/src/studio-home/tabs-section/courses-tab/courses-filters/courses-types-filter-menu/index.jsx index f668a577b4..f655d47a58 100644 --- a/src/studio-home/tabs-section/courses-tab/courses-filters/courses-types-filter-menu/index.jsx +++ b/src/studio-home/tabs-section/courses-tab/courses-filters/courses-types-filter-menu/index.jsx @@ -40,6 +40,7 @@ const CoursesTypesFilterMenu = ({ onItemMenuSelected }) => { menuItems={courseTypes} onItemMenuSelected={handleCourseTypeSelected} defaultItemSelectedText={intl.formatMessage(messages.coursesTypesFilterMenuActiveCurses)} + menuType="courseTypes" /> ); };