Skip to content

Commit 6d86447

Browse files
authored
Merge pull request #2817 from GetStream/develop
Next Release
2 parents 6accaec + f26e974 commit 6d86447

File tree

6 files changed

+16
-7
lines changed

6 files changed

+16
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
[![NPM](https://img.shields.io/npm/v/stream-chat-react-native.svg)](https://www.npmjs.com/package/stream-chat-react-native)
1212
[![Build Status](https://github.com/GetStream/stream-chat-react-native/actions/workflows/release.yml/badge.svg)](https://github.com/GetStream/stream-chat-react-native/actions)
1313
[![Component Reference](https://img.shields.io/badge/docs-component%20reference-blue.svg)](https://getstream.io/chat/docs/sdk/reactnative)
14-
![JS Bundle Size](https://img.shields.io/badge/js_bundle_size-451%20KB-blue)
14+
![JS Bundle Size](https://img.shields.io/badge/js_bundle_size-452%20KB-blue)
1515

1616
<img align="right" src="https://getstream.imgix.net/images/ios-chat-tutorial/iphone_chat_art@3x.png?auto=format,enhance" width="50%" />
1717

package/src/components/Chat/hooks/__tests__/useAppSettings.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ describe('useAppSettings', () => {
1818
auto_translation_enabled: true,
1919
}),
2020
),
21+
userID: 'some-user-id',
2122
} as unknown as StreamChat,
2223
isOnline,
2324
false,

package/src/components/Chat/hooks/useAppSettings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export const useAppSettings = <
2222
* Fetches app settings from the backend when offline support is disabled.
2323
*/
2424
const enforceAppSettingsWithoutOfflineSupport = async () => {
25+
if (!client.userID) return;
26+
2527
try {
2628
const appSettings = await client.getAppSettings();
2729
if (isMounted.current) {

package/src/components/MessageOverlay/MessageOverlay.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ const MessageOverlayWithContext = <
478478
{!!messageReactionTitle && (
479479
<OverlayReactions
480480
alignment={alignment}
481+
message={message}
481482
messageId={message.id}
482483
OverlayReactionsAvatar={OverlayReactionsAvatar}
483484
showScreen={showScreen}

package/src/components/MessageOverlay/OverlayReactions.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222

2323
import type { DefaultStreamChatGenerics } from '../../types/types';
2424
import type { ReactionData } from '../../utils/utils';
25+
import { MessageType } from '../MessageList/hooks/useMessageList';
2526

2627
const styles = StyleSheet.create({
2728
avatarContainer: {
@@ -89,6 +90,7 @@ export type OverlayReactionsProps<
8990
showScreen: Animated.SharedValue<number>;
9091
title: string;
9192
alignment?: Alignment;
93+
message?: MessageType<StreamChatGenerics>;
9294
messageId?: string;
9395
reactions?: Reaction[];
9496
supportedReactions?: ReactionData[];
@@ -105,7 +107,7 @@ export const OverlayReactions = (props: OverlayReactionsProps) => {
105107
const [itemHeight, setItemHeight] = React.useState(0);
106108
const {
107109
alignment: overlayAlignment,
108-
messageId,
110+
message,
109111
OverlayReactionsAvatar,
110112
reactions: propReactions,
111113
showScreen,
@@ -119,7 +121,7 @@ export const OverlayReactions = (props: OverlayReactionsProps) => {
119121
loadNextPage,
120122
reactions: fetchedReactions,
121123
} = useFetchReactions({
122-
messageId,
124+
message,
123125
sort,
124126
});
125127

package/src/components/MessageOverlay/hooks/useFetchReactions.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
22

33
import { ReactionResponse, ReactionSort } from 'stream-chat';
44

5+
import { MessageType } from '../../../components/MessageList/hooks/useMessageList';
56
import { useChatContext } from '../../../contexts/chatContext/ChatContext';
67
import { getReactionsForFilterSort } from '../../../store/apis/getReactionsforFilterSort';
78
import { DefaultStreamChatGenerics } from '../../../types/types';
@@ -10,7 +11,7 @@ export type UseFetchReactionParams<
1011
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
1112
> = {
1213
limit?: number;
13-
messageId?: string;
14+
message?: MessageType<StreamChatGenerics>;
1415
reactionType?: string;
1516
sort?: ReactionSort<StreamChatGenerics>;
1617
};
@@ -19,13 +20,14 @@ export const useFetchReactions = <
1920
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
2021
>({
2122
limit = 25,
22-
messageId,
23+
message,
2324
reactionType,
2425
sort,
2526
}: UseFetchReactionParams) => {
2627
const [reactions, setReactions] = useState<ReactionResponse<StreamChatGenerics>[]>([]);
2728
const [loading, setLoading] = useState(true);
2829
const [next, setNext] = useState<string | undefined>(undefined);
30+
const messageId = message?.id;
2931

3032
const { client, enableOfflineSupport } = useChatContext();
3133

@@ -61,8 +63,9 @@ export const useFetchReactions = <
6163
};
6264

6365
try {
64-
if (enableOfflineSupport) {
65-
loadOfflineReactions();
66+
// TODO: Threads are not supported for the offline use case as we don't store the thread messages currently, and this will change in the future.
67+
if (enableOfflineSupport && !message?.parent_id) {
68+
await loadOfflineReactions();
6669
} else {
6770
await loadOnlineReactions();
6871
}

0 commit comments

Comments
 (0)