Skip to content

Commit

Permalink
style: 增加类型与注释
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Jan 22, 2020
1 parent 6b7cec1 commit 4a890e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/shared/redux/reducers/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ export default produce((draft: ChatState, action) => {
if (!_isNil(converse)) {
const msgList = converse.msgList;

// NOTE: 这里可能会有一个问题。就是在团消息中因为消息也会给自己发一份,
// 因此如果SEND_MSG_COMPLETED在该条消息的团广播到达之后收到的话就会出现两条一样的消息
// 如果socket.io能保证消息的时序的话就不会出现这个问题。观察一波
const index = msgList.findIndex((item) => item.uuid === localUUID);
if (index >= 0) {
msgList[index] = {
Expand Down
7 changes: 5 additions & 2 deletions src/shared/redux/types/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,19 @@ export type ChatStateConverse = {
uuid: string;
type: string;
name: string;
icon: string;
icon?: string;
lastMsg: string;
lastTime: number;
msgList: ChatStateConverseMsgList;

// 客户端信息
unread?: boolean;
};

export type ChatState = {
selectedConverseUUID: string;
conversesDesc: string;
converses: { [name: string]: any };
converses: { [name: string]: ChatStateConverse };
writingList: WritingListType;
emotions: { [name in 'catalogs' | 'favorites']: any[] };
};

0 comments on commit 4a890e5

Please sign in to comment.