-
Notifications
You must be signed in to change notification settings - Fork 352
Description
Stream Chat React Native: deleted_reply_count
Always Returns 0
Issue Summary
The deleted_reply_count
field in message objects is always returning 0
, even when messages have been deleted from threads. This breaks the calculation of visible replies (reply_count - deleted_reply_count
), causing incorrect UI behavior for deleted messages and thread indicators.
Expected Behaviour
When messages are deleted from a thread, the deleted_reply_count
should increment accordingly, allowing proper calculation of visible replies for:
- Showing/hiding thread reply indicators on deleted parent messages
- Displaying correct reply counts in thread UIs
Actual Behavior
deleted_reply_count
always returns 0
, making it impossible to distinguish between threads with no replies vs threads where all replies have been deleted.
Environment Details
- stream-chat:
8.59.0
- stream-chat-expo:
6.7.2
- stream-chat-react-native-core:
6.7.2
- React Native:
0.79.5
- Expo:
~53.0.22
Code Implementation
The issue affects multiple components that rely on visible reply calculations:
// In DeletedMessageLayout.tsx and ThreadReplyIndicator.tsx
const totalReplies = message?.reply_count ?? 0;
const deletedReplies = message?.deleted_reply_count ?? 0; // Always 0
const visibleReplies = Math.max(0, totalReplies - deletedReplies);
Steps to Reproduce
- Create a message with thread replies
- Delete one or more replies from the thread
- Check the
deleted_reply_count
field on the parent message - it will be0
instead of the expected count - Thread reply indicators and deleted message UIs will show incorrect reply counts
Additional Context
- The field is properly typed in the Stream Chat TypeScript definitions as
deleted_reply_count?: number
- This affects the UI logic for showing thread continuation on deleted messages
- The issue prevents proper differentiation between messages with no replies vs messages where all replies have been deleted
Impact
This bug prevents correct UI behavior for:
- Deleted message thread indicators
- Reply count displays
- Thread navigation logic for deleted messages
Type Definition Location
The field is defined in /node_modules/stream-chat/src/types.ts
at line 710 in the MessageResponseBase
type:
export type MessageResponseBase<
StreamChatGenerics extends ExtendableGenerics = DefaultGenerics
> = MessageBase<StreamChatGenerics> & {
// ... other fields
deleted_reply_count?: number; // This field always returns 0
reply_count?: number;
// ... other fields
};