Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
Revert the search results component to not bind directly to the searc…
Browse files Browse the repository at this point in the history
…h bar search terms (#4159)
  • Loading branch information
marianunez committed Nov 11, 2019
1 parent c34ff06 commit d347857
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions actions/views/rhs.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ export function updateSearchTerms(terms) {
};
}

function updateSearchResultsTerms(terms) {
return {
type: ActionTypes.UPDATE_RHS_SEARCH_RESULTS_TERMS,
terms,
};
}

export function performSearch(terms, isMentionSearch) {
return (dispatch, getState) => {
const teamId = getCurrentTeamId(getState());
Expand All @@ -101,10 +108,7 @@ export function showSearchResults() {
const searchTerms = getSearchTerms(getState());

dispatch(updateRhsState(RHSStates.SEARCH));
dispatch({
type: ActionTypes.UPDATE_RHS_SEARCH_RESULTS_TERMS,
terms: searchTerms,
});
dispatch(updateSearchResultsTerms(searchTerms));

return dispatch(performSearch(searchTerms));
};
Expand Down Expand Up @@ -284,6 +288,7 @@ export function openRHSSearch() {
return (dispatch) => {
dispatch(clearSearch());
dispatch(updateSearchTerms(''));
dispatch(updateSearchResultsTerms(''));

dispatch(updateRhsState(RHSStates.SEARCH));
};
Expand Down
4 changes: 2 additions & 2 deletions components/search_results/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
import {getCurrentSearchForCurrentTeam} from 'mattermost-redux/selectors/entities/search';

import {
getSearchTerms,
getSearchResultsTerms,
getIsSearchingTerm,
getIsSearchingFlaggedPost,
getIsSearchingPinnedPost,
Expand Down Expand Up @@ -61,7 +61,7 @@ function makeMapStateToProps() {
results: posts,
matches: getSearchMatches(state),
currentUser: getCurrentUser(state),
searchTerms: getSearchTerms(state),
searchTerms: getSearchResultsTerms(state),
isSearchingTerm: getIsSearchingTerm(state),
isSearchingFlaggedPost: getIsSearchingFlaggedPost(state),
isSearchingPinnedPost: getIsSearchingPinnedPost(state),
Expand Down

0 comments on commit d347857

Please sign in to comment.