Skip to content

deleted_reply_count field always returns 0 in message objects #3229

@virajpsimformsolutions

Description

@virajpsimformsolutions

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

  1. Create a message with thread replies
  2. Delete one or more replies from the thread
  3. Check the deleted_reply_count field on the parent message - it will be 0 instead of the expected count
  4. 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
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions