Use ReadonlyArrays in conversation model and redux

This commit is contained in:
Fedor Indutny
2022-12-21 16:07:02 -08:00
committed by GitHub
parent ecbf84638d
commit dec23725e5
55 changed files with 173 additions and 162 deletions

View File

@@ -279,7 +279,7 @@ export const _getLeftPaneLists = (
lookup: ConversationLookupType,
comparator: (left: ConversationType, right: ConversationType) => number,
selectedConversation?: string,
pinnedConversationIds?: Array<string>
pinnedConversationIds?: ReadonlyArray<string>
): {
conversations: Array<ConversationType>;
archivedConversations: Array<ConversationType>;
@@ -603,7 +603,7 @@ export const getFilteredComposeContacts = createSelector(
getRegionCode,
(
searchTerm: string,
contacts: Array<ConversationType>,
contacts: ReadonlyArray<ConversationType>,
regionCode: string | undefined
): Array<ConversationType> => {
return filterAndSortConversationsByRecent(contacts, searchTerm, regionCode);
@@ -616,7 +616,7 @@ export const getFilteredComposeGroups = createSelector(
getRegionCode,
(
searchTerm: string,
groups: Array<ConversationType>,
groups: ReadonlyArray<ConversationType>,
regionCode: string | undefined
): Array<ConversationType> => {
return filterAndSortConversationsByRecent(groups, searchTerm, regionCode);
@@ -638,7 +638,7 @@ const getGroupCreationComposerState = createSelector(
groupName: string;
groupAvatar: undefined | Uint8Array;
groupExpireTimer: DurationInSeconds;
selectedConversationIds: Array<string>;
selectedConversationIds: ReadonlyArray<string>;
} => {
switch (composerState?.step) {
case ComposerStep.ChooseGroupMembers:

View File

@@ -36,5 +36,6 @@ export const getSelectedIndex = createSelector(
export const getMedia = createSelector(
getLightboxState,
(state): Array<MediaItemType> => (state.isShowingLightbox ? state.media : [])
(state): ReadonlyArray<MediaItemType> =>
state.isShowingLightbox ? state.media : []
);