Skip to content

fix: remove MessageType type from the SDK #3064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: V7
Choose a base branch
from

Conversation

khushal87
Copy link
Member

The goal of the PR is to get rid of the MessageType type from the SDK and keep the LocalMessage as the single source of truth for the message. This is in line with the LLC and React SDK. The group styles, date separators and the message readby are now sent separately and used separately.

@Stream-SDK-Bot
Copy link
Contributor

Stream-SDK-Bot commented Apr 23, 2025

SDK Size

title develop branch diff status
js_bundle_size 468 KB 465 KB -2726 B 🚀

@khushal87 khushal87 marked this pull request as ready for review April 24, 2025 06:05
@@ -291,9 +291,8 @@ export const useMessageActions = ({
const retry: MessageActionType = {
action: async () => {
dismissOverlay();
const messageWithoutReservedFields = removeReservedFields(message);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already remove the reserved fields on the Channel component in retrySendMessage function so there's no point of doing it here as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be used without relying on retrySendMessage ? If so, we should keep it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct. i missed it. I will revert the change

@@ -756,20 +753,20 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
const showUnreadUnderlay = !!shouldShowUnreadUnderlay && showUnreadSeparator;

const wrapMessageInTheme = client.userID === message.user?.id && !!myMessageTheme;
const renderDateSeperator = isMessageWithStylesReadByAndDateSeparator(message) &&
message.dateSeparator && <InlineDateSeparator date={message.dateSeparator} />;
const renderDateSeperator = dateSeparators[message.id] && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not having dateSeparator on our message is now very breaking in terms of the fact integrators will no longer have a way of using this. The general idea was to remove the enriched properties from message, but provide an alternative way to get them (and use them only where they're needed - for example, readBy is really only used in MessageStatus so there's no need for us to pass it to the entire message).

isTargetedMessage={highlightedMessageId === message.id}
lastReceivedId={
lastReceivedId === message.id || message.quoted_message_id ? lastReceivedId : undefined
}
message={message}
onThreadSelect={onThreadSelect}
readBy={readData[message.id]}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following up on the comment above, this would allow us to:

  • Not have to drill props to every Message component (which is costly, because it forces a relatively expensive rerender of each FlatList item)
  • Have renderItem depend on less props (which we want, because we want it to be as pure as possible)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants