Timeline: repair oldest/newest metrics if we fetch nothing
This commit is contained in:
parent
56ae4a41eb
commit
6832b8acca
47 changed files with 579 additions and 173 deletions
|
@ -15,6 +15,7 @@ import {
|
|||
MessagesByConversationType,
|
||||
MessageType,
|
||||
} from '../ducks/conversations';
|
||||
|
||||
import { getBubbleProps } from '../../shims/Whisper';
|
||||
import { PropsDataType as TimelinePropsType } from '../../components/conversation/Timeline';
|
||||
import { TimelineItemType } from '../../components/conversation/TimelineItem';
|
||||
|
@ -26,6 +27,7 @@ import {
|
|||
getUserConversationId,
|
||||
getUserNumber,
|
||||
} from './user';
|
||||
import { getPinnedConversationIds } from './items';
|
||||
|
||||
export const getConversations = (state: StateType): ConversationsStateType =>
|
||||
state.conversations;
|
||||
|
@ -127,7 +129,8 @@ export const getConversationComparator = createSelector(
|
|||
export const _getLeftPaneLists = (
|
||||
lookup: ConversationLookupType,
|
||||
comparator: (left: ConversationType, right: ConversationType) => number,
|
||||
selectedConversation?: string
|
||||
selectedConversation?: string,
|
||||
pinnedConversationIds?: Array<string>
|
||||
): {
|
||||
conversations: Array<ConversationType>;
|
||||
archivedConversations: Array<ConversationType>;
|
||||
|
@ -162,13 +165,10 @@ export const _getLeftPaneLists = (
|
|||
conversations.sort(comparator);
|
||||
archivedConversations.sort(comparator);
|
||||
|
||||
const pinnedConversationIds = window.storage.get<Array<string>>(
|
||||
'pinnedConversationIds',
|
||||
[]
|
||||
);
|
||||
pinnedConversations.sort(
|
||||
(a, b) =>
|
||||
pinnedConversationIds.indexOf(a.id) - pinnedConversationIds.indexOf(b.id)
|
||||
(pinnedConversationIds || []).indexOf(a.id) -
|
||||
(pinnedConversationIds || []).indexOf(b.id)
|
||||
);
|
||||
|
||||
return { conversations, archivedConversations, pinnedConversations };
|
||||
|
@ -178,6 +178,7 @@ export const getLeftPaneLists = createSelector(
|
|||
getConversationLookup,
|
||||
getConversationComparator,
|
||||
getSelectedConversation,
|
||||
getPinnedConversationIds,
|
||||
_getLeftPaneLists
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue