Fix JS error from null posts (#6722)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
a077cae279
Коммит
458d7d0021
@@ -12,12 +12,13 @@ import {Preferences} from 'utils/constants.jsx';
|
|||||||
import Post from './post.jsx';
|
import Post from './post.jsx';
|
||||||
|
|
||||||
function mapStateToProps(state, ownProps) {
|
function mapStateToProps(state, ownProps) {
|
||||||
const detailedPost = ownProps.post;
|
const detailedPost = ownProps.post || {};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
post: getPost(state, detailedPost.id),
|
post: getPost(state, detailedPost.id),
|
||||||
lastPostCount: ownProps.lastPostCount,
|
lastPostCount: ownProps.lastPostCount,
|
||||||
user: getUser(state, ownProps.post.user_id),
|
user: getUser(state, detailedPost.user_id),
|
||||||
status: getStatusForUserId(state, ownProps.post.user_id),
|
status: getStatusForUserId(state, detailedPost.user_id),
|
||||||
currentUser: getCurrentUser(state),
|
currentUser: getCurrentUser(state),
|
||||||
isFirstReply: Boolean(detailedPost.isFirstReply && detailedPost.commentedOnPost),
|
isFirstReply: Boolean(detailedPost.isFirstReply && detailedPost.commentedOnPost),
|
||||||
highlight: detailedPost.highlight,
|
highlight: detailedPost.highlight,
|
||||||
|
|||||||
@@ -370,6 +370,10 @@ export default class PostList extends React.PureComponent {
|
|||||||
for (let i = posts.length - 1; i >= 0; i--) {
|
for (let i = posts.length - 1; i >= 0; i--) {
|
||||||
const post = posts[i];
|
const post = posts[i];
|
||||||
|
|
||||||
|
if (post == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const postCtl = (
|
const postCtl = (
|
||||||
<Post
|
<Post
|
||||||
ref={post.id}
|
ref={post.id}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user