Skip to content

Hometask6#83

Open
sergeyBreslavets wants to merge 8 commits intoromabelka:masterfrom
sergeyBreslavets:hometask6
Open

Hometask6#83
sergeyBreslavets wants to merge 8 commits intoromabelka:masterfrom
sergeyBreslavets:hometask6

Conversation

@sergeyBreslavets
Copy link

No description provided.

@sergeyBreslavets
Copy link
Author

не особо разобрался как стоит сделать правильную выборку из статей комментариев, я их туда смог запихнуть, но вот сделать правильную выборку, через селектор пока не понял как

const body = comments.length ? (
<ul>
{comments.map(id => <li key = {id}><Comment id = {id} /></li>)}
{comments.map(comment => <li key = {comment['id']}><Comment id = {comment['id']} /></li>)}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

вот этого хода я совсем не осознал) зачем доставать id из коммента, чтоб потом по нему снова найти этот коммент из стора?

console.log(payload.response)
return comments
.set('loading', false)
.set('loaded', true)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему loaded === true, ведь ты загрузил только для одной статьи?

}))

case LOAD_COMMENT + START:
return comments.set('loading', true)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

здесь не достаточно повесить loading на весь comments, ведь ты для конкрентной статьи загружаешь

return comments
.set('loading', false)
.set('loaded', true)
.set('entities', arrToMap(payload.response, CommentsRecord))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

сейчас загружая комменты для одной статьи ты перезатираешь прошлые; используй .mergeIn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants