Handling nulls in getMyCurrentChannelMembership (#2488)
This commit is contained in:
parent
37d16d4cbc
commit
a81701092d
2 changed files with 4 additions and 3 deletions
|
|
@ -18,6 +18,7 @@ import ChannelPostList from './channel_post_list';
|
|||
function mapStateToProps(state) {
|
||||
const channelId = getCurrentChannelId(state);
|
||||
const channelRefreshingFailed = state.views.channel.retryFailed;
|
||||
const currentChannelMember = getMyCurrentChannelMembership(state);
|
||||
|
||||
return {
|
||||
channelId,
|
||||
|
|
@ -26,7 +27,7 @@ function mapStateToProps(state) {
|
|||
deviceHeight: state.device.dimension.deviceHeight,
|
||||
postIds: getPostIdsInCurrentChannel(state),
|
||||
postVisibility: state.views.channel.postVisibility[channelId],
|
||||
lastViewedAt: getMyCurrentChannelMembership(state).last_viewed_at,
|
||||
lastViewedAt: currentChannelMember && currentChannelMember.last_viewed_at,
|
||||
loadMorePostsVisible: state.views.channel.loadMorePostsVisible,
|
||||
refreshing: state.views.channel.refreshing,
|
||||
theme: getTheme(state),
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ export default class Thread extends PureComponent {
|
|||
}
|
||||
|
||||
if (!this.state.lastViewedAt) {
|
||||
this.setState({lastViewedAt: nextProps.myMember.last_viewed_at});
|
||||
this.setState({lastViewedAt: nextProps.myMember && nextProps.myMember.last_viewed_at});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ export default class Thread extends PureComponent {
|
|||
renderFooter={this.renderFooter()}
|
||||
indicateNewMessages={true}
|
||||
postIds={postIds}
|
||||
currentUserId={myMember.user_id}
|
||||
currentUserId={myMember && myMember.user_id}
|
||||
lastViewedAt={this.state.lastViewedAt}
|
||||
navigator={navigator}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue