Team selection causes blank channel view fix (#203)
This commit is contained in:
parent
a50b9bd337
commit
c9e513f83b
3 changed files with 11 additions and 6 deletions
|
|
@ -8,6 +8,11 @@ import {updateStorage} from 'app/actions/storage';
|
|||
|
||||
export function handleTeamChange(team) {
|
||||
return async (dispatch, getState) => {
|
||||
const currentTeamId = getState().entities.teams.currentId;
|
||||
if (currentTeamId === team.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
const storage = await updateStorage('currentTeamId', team.id);
|
||||
const lastChannelForTeam = storage[team.id] ? storage[team.id].currentChannelId : '';
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export default class ChannelDrawer extends React.PureComponent {
|
|||
static propTypes = {
|
||||
actions: React.PropTypes.shape({
|
||||
closeDrawers: React.PropTypes.func.isRequired,
|
||||
selectChannel: React.PropTypes.func.isRequired
|
||||
handleSelectChannel: React.PropTypes.func.isRequired
|
||||
}).isRequired,
|
||||
currentTeam: React.PropTypes.object,
|
||||
currentChannel: React.PropTypes.object,
|
||||
|
|
@ -19,7 +19,7 @@ export default class ChannelDrawer extends React.PureComponent {
|
|||
};
|
||||
|
||||
selectChannel = (id) => {
|
||||
this.props.actions.selectChannel(id);
|
||||
this.props.actions.handleSelectChannel(id);
|
||||
this.props.actions.closeDrawers();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ import {bindActionCreators} from 'redux';
|
|||
import {connect} from 'react-redux';
|
||||
|
||||
import {closeDrawers} from 'app/actions/navigation';
|
||||
import {closeDMChannel, leaveChannel, markFavorite, unmarkFavorite} from 'app/actions/views/channel';
|
||||
import {closeDMChannel, handleSelectChannel, leaveChannel, markFavorite, unmarkFavorite} from 'app/actions/views/channel';
|
||||
|
||||
import {selectChannel, viewChannel} from 'service/actions/channels';
|
||||
import {viewChannel} from 'service/actions/channels';
|
||||
import {getChannelsByCategory, getCurrentChannel} from 'service/selectors/entities/channels';
|
||||
import {getTheme} from 'service/selectors/entities/preferences';
|
||||
import {getCurrentTeam} from 'service/selectors/entities/teams';
|
||||
|
|
@ -27,13 +27,13 @@ function mapStateToProps(state) {
|
|||
function mapDispatchToProps(dispatch) {
|
||||
return {
|
||||
actions: bindActionCreators({
|
||||
selectChannel,
|
||||
viewChannel,
|
||||
closeDMChannel,
|
||||
closeDrawers,
|
||||
leaveChannel,
|
||||
markFavorite,
|
||||
unmarkFavorite
|
||||
unmarkFavorite,
|
||||
handleSelectChannel
|
||||
}, dispatch)
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue