Skip to content

Commit 9012e99

Browse files
authored
Improve MessageListParams interface in ChannelProvider (#984)
fix from #980 thanks to @tylerhammer
1 parent f3a3706 commit 9012e99

File tree

2 files changed

+15
-24
lines changed

2 files changed

+15
-24
lines changed

src/modules/Channel/context/ChannelProvider.tsx

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import type {
1515
UserMessage,
1616
UserMessageCreateParams,
1717
UserMessageUpdateParams,
18+
MessageListParams as SDKMessageListParams,
1819
} from '@sendbird/chat/message';
1920
import type { EmojiContainer, SendbirdError, User } from '@sendbird/chat';
2021

@@ -51,23 +52,13 @@ import { useHandleChannelPubsubEvents } from './hooks/useHandleChannelPubsubEven
5152
import { PublishingModuleType } from '../../internalInterfaces';
5253
import { ChannelActionTypes } from './dux/actionTypes';
5354

54-
export type MessageListParams = {
55-
// https://sendbird.github.io/core-sdk-javascript/module-model_params_messageListParams-MessageListParams.html
56-
replyType?: string,
57-
messageType?: string,
58-
prevResultSize?: number,
59-
nextResultSize?: number,
60-
reverse?: boolean, // TODO: Deprecate this props, because it might not work
61-
isInclusive?: boolean,
62-
includeMetaArray?: boolean,
63-
includeReactions?: boolean,
64-
includeThreadInfo?: boolean,
65-
includeParentMessageInfo?: boolean,
66-
showSubchannelMessagesOnly?: boolean,
67-
customTypes?: Array<string>,
68-
senderUserIds?: Array<string>,
69-
};
70-
55+
export interface MessageListParams extends Partial<SDKMessageListParams> { // make `prevResultSize` and `nextResultSize` to optional
56+
/**
57+
* @deprecated
58+
* It won't work even if you activate this props
59+
*/
60+
reverse?: boolean; // TODO: Deprecate this props, because it might not work
61+
}
7162
export type ChannelQueries = {
7263
messageListParams?: MessageListParams;
7364
};

src/modules/Channel/context/dux/actionTypes.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import type { EmojiContainer } from '@sendbird/chat';
2+
import type { GroupChannel, Member } from '@sendbird/chat/groupChannel';
3+
import type { ReactionEvent } from '@sendbird/chat/message';
4+
5+
import type { MessageListParams } from '../ChannelProvider';
6+
import type { CoreMessageType, SendableMessageType } from '../../../../utils';
7+
import type { FileUploadedPayload } from '../hooks/useSendMultipleFilesMessage';
18
import { CreateAction } from '../../../../utils/typeHelpers/reducers/createAction';
2-
import { GroupChannel } from '@sendbird/chat/groupChannel';
3-
import { CoreMessageType, SendableMessageType } from '../../../../utils';
4-
import { EmojiContainer } from '@sendbird/chat';
5-
import { ReactionEvent } from '@sendbird/chat/message';
6-
import { MessageListParams } from '../ChannelProvider';
7-
import { FileUploadedPayload } from '../hooks/useSendMultipleFilesMessage';
8-
import { Member } from '@sendbird/chat/lib/__definition';
99

1010
export const RESET_MESSAGES = 'RESET_MESSAGES';
1111
export const FETCH_INITIAL_MESSAGES_START = 'FETCH_INITIAL_MESSAGES_START';

0 commit comments

Comments
 (0)