[FIX] Fix display order render on RoomListView (#4392)

This commit is contained in:
Gleidson Daniel Silva 2022-08-01 13:42:10 -03:00 committed by GitHub
parent 41dbbf4d4b
commit 2c32be6e51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 15 deletions

View File

@ -530,21 +530,6 @@ class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewS
let chats = data; let chats = data;
let omnichannelsUpdate: string[] = []; let omnichannelsUpdate: string[] = [];
let chatsUpdate = [];
if (showUnread) {
/**
* If unread on top, we trigger re-render based on order changes and sub.alert
* RoomItem handles its own re-render
*/
chatsUpdate = data.map(item => ({ rid: item.rid, alert: item.alert }));
} else {
/**
* Otherwise, we trigger re-render only when chats order changes
* RoomItem handles its own re-render
*/
chatsUpdate = data.map(item => item.rid);
}
const isOmnichannelAgent = user?.roles?.includes('livechat-agent'); const isOmnichannelAgent = user?.roles?.includes('livechat-agent');
if (isOmnichannelAgent) { if (isOmnichannelAgent) {
const omnichannel = chats.filter(s => filterIsOmnichannel(s)); const omnichannel = chats.filter(s => filterIsOmnichannel(s));
@ -586,6 +571,8 @@ class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewS
tempChats = chats; tempChats = chats;
} }
const chatsUpdate = tempChats.map(item => item.rid);
this.internalSetState({ this.internalSetState({
chats: tempChats, chats: tempChats,
chatsUpdate, chatsUpdate,