Skip to content

Notification feed stream emits stale state for comment/reaction activity types #77

@andrewmikhniuk

Description

@andrewmikhniuk

Bug Report: FeedState stream emits stale state for 'comment', 'reaction', and 'comment_reaction' activity types

Package version: stream_feeds: ^0.5.0

Description

When listening to Feed.stream for notification feeds, the stream does emit when new activities of type 'comment', 'reaction', or 'comment_reaction' are received, but it emits the old/stale state instead of the updated state containing the new activity.

Expected behavior

When a new comment, reaction, or comment_reaction activity is added to the feed, the FeedState stream should emit a new state that includes the newly added activity.

Actual behavior

The stream listener is triggered when activities of type 'comment', 'reaction', or 'comment_reaction' are added, but the emitted FeedState contains the previous state without the new activity. The new activity only appears after manually refreshing the feed.

Important: When re-initializing the feed (calling getOrCreate() again), the initial state is correct and includes the new notifications. This indicates the issue is specifically with the stream not emitting the updated state.

Code to reproduce
final query = FeedQuery(
  fid: FeedId.notification(client.user.id),
);
final feed = client.feedFromQuery(query);
await feed.getOrCreate();

notificationsStream = feed.stream.listen((streamState) {
  // When activity.type is 'comment', 'reaction', or 'comment_reaction':
  // - This callback IS called
  // - But streamState.activities contains the OLD state, not the new activity
  print('Activities: ${streamState.activities}');
});
Impact

Notification badges and real-time notification lists do not update when users receive comments or reactions on their posts, even though the stream event fires.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions