Skip to content

Commit

Permalink
feat: Only change url when hit search button
Browse files Browse the repository at this point in the history
  • Loading branch information
germanolleunlp committed Dec 6, 2023
1 parent e5937de commit b4e2ca2
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/course-home/courseware-search/CoursewareSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ const CoursewareSearch = ({ intl, ...sectionProps }) => {
}));
};

const handleSubmit = () => {
if (!searchKeyword) {
const handleSubmit = (value) => {
if (!value) {
clearSearch();
return;
}
Expand All @@ -59,24 +59,20 @@ const CoursewareSearch = ({ intl, ...sectionProps }) => {
org_key: org,
courserun_key: courseId,
event_type: 'searchKeyword',
keyword: searchKeyword,
keyword: value,
});

dispatch(searchCourseContent(courseId, searchKeyword));
dispatch(searchCourseContent(courseId, value));
setQuery(value);
};

useEffect(() => {
handleSubmit();
handleSubmit(searchKeyword);
}, []);

const handleOnChange = (value) => {
if (value === searchKeyword) { return; }
if (!value) {
clearSearch();
return;
}

setQuery(value);
if (!value) { clearSearch(); }
};

const handleSearchCloseClick = () => {
Expand Down

0 comments on commit b4e2ca2

Please sign in to comment.