diff --git a/src/constants/errors.ts b/src/constants/errors.ts index 1aac68d2..fbb68c4e 100644 --- a/src/constants/errors.ts +++ b/src/constants/errors.ts @@ -41,6 +41,7 @@ export const ERRORS = { CANT_DELETE_COMMENT: 'CantDeleteComment', CANT_RESTORE_COMMENT: 'CantRestoreComment', MESSAGE_NOT_FOUND: 'MessageNotFound', + COMMENT_TOO_LONG: 'CommentTooLong', }; export const ERROR_LITERAL = { @@ -87,4 +88,5 @@ export const ERROR_LITERAL = { [ERRORS.CANT_DELETE_COMMENT]: 'Не удалось удалить комментарий', [ERRORS.CANT_RESTORE_COMMENT]: 'Не удалось восстановить комментарий', [ERRORS.MESSAGE_NOT_FOUND]: 'Сообщение не найдено', + [ERRORS.COMMENT_TOO_LONG]: 'Комментарий слишком длинный', }; diff --git a/src/redux/node/sagas.ts b/src/redux/node/sagas.ts index b2e0e4a2..7a37a9cb 100644 --- a/src/redux/node/sagas.ts +++ b/src/redux/node/sagas.ts @@ -213,7 +213,7 @@ function* onPostComment({ id }: ReturnType) { const { current: current_node } = yield select(selectNode); if (current_node && current_node.id === current.id) { - const { comments, comment_data } = yield select(selectNode); + const { comments, comment_data: current_comment_data } = yield select(selectNode); if (id === 0) { yield put(nodeSetCommentData(0, { ...EMPTY_COMMENT })); @@ -221,7 +221,7 @@ function* onPostComment({ id }: ReturnType) { } else { yield put( nodeSet({ - comment_data: omit([id.toString()], comment_data), + comment_data: omit([id.toString()], current_comment_data), comments: comments.map(item => (item.id === id ? comment : item)), }) );