From 0a631cfcaea1b005d5ac29152cc9fef598432b97 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Thu, 31 Aug 2017 16:12:28 +0700 Subject: [PATCH] Hide viewing options when changing sort --- plugin-api/beta/client/hocs/withSortOption.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin-api/beta/client/hocs/withSortOption.js b/plugin-api/beta/client/hocs/withSortOption.js index 076d921e7..1bdccbfc1 100644 --- a/plugin-api/beta/client/hocs/withSortOption.js +++ b/plugin-api/beta/client/hocs/withSortOption.js @@ -4,6 +4,7 @@ import {bindActionCreators} from 'redux'; import {sortOrderSelector, sortBySelector} from 'plugin-api/beta/client/selectors/stream'; import {setSort} from 'plugin-api/beta/client/actions/stream'; import hoistStatics from 'recompose/hoistStatics'; +import {closeMenu} from 'plugins/talk-plugin-viewing-options/client/actions'; const mapStateToProps = (state) => ({ sortOrder: sortOrderSelector(state), @@ -13,7 +14,8 @@ const mapStateToProps = (state) => ({ const mapDispatchToProps = (dispatch) => bindActionCreators( { - setSort + setSort, + closeMenu, }, dispatch ); @@ -29,6 +31,7 @@ const mapDispatchToProps = (dispatch) => export default ({sortBy = 'created_at', sortOrder = 'DESC', label}) => hoistStatics((WrappedComponent) => { class WithSortOption extends React.Component { setSort = () => { + this.props.closeMenu(); this.props.setSort({sortBy, sortOrder}); }