bug fix :: 대화방 리스트에 갖고 있지 않은 새 대화방의 대화가 유입 시 unReadCount 수집에 발생하는 에러 수정.

This commit is contained in:
leejh 2019-10-18 13:34:24 +09:00
parent 7b67d21ff3
commit d8d58e3bd7
2 changed files with 15 additions and 7 deletions

View File

@ -227,13 +227,15 @@ export class Effects {
// not opened room :: unread count increased // not opened room :: unread count increased
if (!roomInfo || roomInfo.roomSeq !== action.roomSeq) { if (!roomInfo || roomInfo.roomSeq !== action.roomSeq) {
const noReadCnt = trgtRoomInfos[action.roomSeq].noReadCnt; if (!!trgtRoomInfos && !!trgtRoomInfos[action.roomSeq]) {
this.store.dispatch( const noReadCnt = trgtRoomInfos[action.roomSeq].noReadCnt;
SyncStore.updateUnreadCount({ this.store.dispatch(
roomSeq: action.roomSeq, SyncStore.updateUnreadCount({
noReadCnt: noReadCnt + 1 roomSeq: action.roomSeq,
}) noReadCnt: noReadCnt + 1
); })
);
}
} }
// 대화 > 리스트 :: finalEventMessage refresh // 대화 > 리스트 :: finalEventMessage refresh

View File

@ -69,6 +69,12 @@ export const reducer = createReducer(
} }
let unReadCount = 0; let unReadCount = 0;
/** SYNC ROOM 으로 정보 수집시 증분값을 받는다면 기존 state 의 정보를 뒤져 noReadCount 를 계산 후 중분 값에 대한 noReadCount 를 더한다. */
// tslint:disable-next-line: forin
for (const key in state.room.entities) {
const value = state.room.entities[key];
unReadCount += value.noReadCnt;
}
action.roomList.map(item => (unReadCount += item.noReadCnt)); action.roomList.map(item => (unReadCount += item.noReadCnt));
return { return {