Unverified Commit 98a5b69f authored by Mattermost Build's avatar Mattermost Build Committed by GitHub
Browse files

[MM-27306] Fix sidebar failing on missing currentTeam (#6032) (#6054)

* Fix sidebar failing on missing currentTeam

* Fix test line

* Fix snapshot

(cherry picked from commit d2ecad69

)
Co-authored-by: default avatarClaudio Costa <cstcld91@gmail.com>
parent 39b74585
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`components/sidebar should match empty div snapshot when teamId is missing 1`] = `<div />`;
exports[`components/sidebar should match snapshot 1`] = `
<div
className=""
......
......@@ -37,7 +37,7 @@ function mapStateToProps(state: GlobalState) {
}
return {
teamId: currentTeam.id,
teamId: currentTeam ? currentTeam.id : '',
canCreatePrivateChannel,
canCreatePublicChannel,
canJoinPublicChannel,
......
......@@ -73,4 +73,16 @@ describe('components/sidebar', () => {
instance.handleOpenMoreDirectChannelsModal(mockEvent as any);
expect(instance.hideMoreDirectChannelsModal).toHaveBeenCalled();
});
test('should match empty div snapshot when teamId is missing', () => {
const props = {
...baseProps,
teamId: '',
};
const wrapper = shallow(
<Sidebar {...props}/>,
);
expect(wrapper).toMatchSnapshot();
});
});
......@@ -176,6 +176,10 @@ export default class Sidebar extends React.PureComponent<Props, State> {
}
render() {
if (!this.props.teamId) {
return (<div/>);
}
return (
<div
id='SidebarContainer'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment