Skip to content

Commit

Permalink
standardise onRemoveSearchQueryClicked.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
faiqali1 committed Aug 3, 2023
1 parent 94a77de commit 8e0414f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/Search/SearchHistory/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import styles from './SearchHistory.module.scss';

import Header from '@/components/Search/PreInput/Header';
import SearchQuerySuggestion from '@/components/Search/PreInput/SearchQuerySuggestion';
import { removeSearchHistoryRecord, selectSearchHistory } from '@/redux/slices/Search/search';
import { removeSearchHistoryRecordAction, selectSearchHistory } from '@/redux/slices/Search/search';
import { areArraysEqual } from '@/utils/array';
import { logButtonClick } from '@/utils/eventLogger';

Expand All @@ -25,7 +25,7 @@ const SearchHistory: React.FC<Props> = ({ onSearchKeywordClicked, isSearchDrawer
(searchQuery: string) => {
// eslint-disable-next-line i18next/no-literal-string
logButtonClick(`search_${isSearchDrawer ? 'drawer' : 'page'}_remove_query`);
dispatch({ type: removeSearchHistoryRecord.type, payload: searchQuery });
dispatch(removeSearchHistoryRecordAction(searchQuery));
},
[dispatch, isSearchDrawer],
);
Expand Down
5 changes: 5 additions & 0 deletions src/redux/slices/Search/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ export const addSearchHistoryRecordAction = (searchQuery: string) => ({
payload: searchQuery,
});

export const removeSearchHistoryRecordAction = (searchQuery: string) => ({
type: removeSearchHistoryRecord.type,
payload: searchQuery,
});

export const selectSearchHistory = (state: RootState) => state.search.searchHistory;

export default searchSlice.reducer;

0 comments on commit 8e0414f

Please sign in to comment.