diff --git a/app/screens/channel/channel_post_list/index.js b/app/screens/channel/channel_post_list/index.js index f18570cf6..74705d22e 100644 --- a/app/screens/channel/channel_post_list/index.js +++ b/app/screens/channel/channel_post_list/index.js @@ -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), diff --git a/app/screens/thread/thread.js b/app/screens/thread/thread.js index 9c8b57022..aa678822d 100644 --- a/app/screens/thread/thread.js +++ b/app/screens/thread/thread.js @@ -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} />