Skip to content

Commit

Permalink
Fixing JS error on channel leave or being removed from the channel (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
jespino committed Dec 4, 2019
1 parent facb5fd commit 9fee649
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions components/sidebar/sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,11 @@ export default class Sidebar extends React.PureComponent {
}

updateScrollbarOnChannelChange = (channelId) => {
const curChannel = this.refs[channelId].getWrappedInstance().refs.channel.getBoundingClientRect();
if ((curChannel.top - Constants.CHANNEL_SCROLL_ADJUSTMENT < 0) || (curChannel.top + curChannel.height > this.refs.scrollbar.view.getBoundingClientRect().height)) {
this.refs.scrollbar.scrollTop(this.refs.scrollbar.view.scrollTop + (curChannel.top - Constants.CHANNEL_SCROLL_ADJUSTMENT));
if (this.refs[channelId]) {
const curChannel = this.refs[channelId].getWrappedInstance().refs.channel.getBoundingClientRect();
if ((curChannel.top - Constants.CHANNEL_SCROLL_ADJUSTMENT < 0) || (curChannel.top + curChannel.height > this.refs.scrollbar.view.getBoundingClientRect().height)) {
this.refs.scrollbar.scrollTop(this.refs.scrollbar.view.scrollTop + (curChannel.top - Constants.CHANNEL_SCROLL_ADJUSTMENT));
}
}
}

Expand Down

0 comments on commit 9fee649

Please sign in to comment.