Skip to content

Hometask6#81

Open
grafviktor wants to merge 2 commits intoromabelka:masterfrom
grafviktor:hometask6
Open

Hometask6#81
grafviktor wants to merge 2 commits intoromabelka:masterfrom
grafviktor:hometask6

Conversation

@grafviktor
Copy link

Поломал добавление комментариев.

return comments
.set('loading', false)
.set('loaded', true)
.set('entities', arrToMap(response, CommentRecord));
Copy link
Author

Choose a reason for hiding this comment

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

Я думаю, что здесь я возвращаю неправильный объект, т.к. у меня все комментарии оказываются в entities.

Copy link
Owner

Choose a reason for hiding this comment

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

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

const body = comments.entities.size > 0 ? (
<ul>
{comments.map(id => <li key = {id}><Comment id = {id} /></li>)}
{comments.entities.valueSeq().map(comment => <li key = {comment.id}><Comment comment={comment} /></li>)}
Copy link
Owner

Choose a reason for hiding this comment

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

сделай для этого селектор, старайся не завязываться в компонентах на api immutable

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

Choose a reason for hiding this comment

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

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


const ReducerRecord = Record({
entities: arrToMap([], CommentRecord),
loading: false,
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, ведь ты для конкрентной статьи загружаешь

case LOAD_ALL_COMMENTS + SUCCESS:
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, ведь ты загрузил только для одной статьи?

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

Comments