Skip to content

fix(ui): filter StreamTypingIndicator initial data by parentId#2842

Merged
VelikovPetar merged 4 commits into
masterfrom
fix/FLU-614_typing_indicator_initial_data_parent_id
Jul 23, 2026
Merged

fix(ui): filter StreamTypingIndicator initial data by parentId#2842
VelikovPetar merged 4 commits into
masterfrom
fix/FLU-614_typing_indicator_initial_data_parent_id

Conversation

@VelikovPetar

@VelikovPetar VelikovPetar commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Submit a pull request

Linear: FLU-614

Github Issue: #

CLA

  • I have signed the Stream CLA (required).
  • The code changes follow best practices
  • Code changes are tested (add some information if not applicable)

Description of the pull request

StreamTypingIndicator seeded its BetterStreamBuilder.initialData from the unfiltered typingEvents map, while its stream filters typing events by parentId. As a result the very first frame could show typing users from the wrong context — main-channel typers in a thread header (ThreadHeader), or thread typers in a channel list tile — until the first stream emission corrected it (visible as a brief flash, stretched by the 300ms AnimatedSwitcher fade).

This PR extracts a shared _typingUsers helper that applies the parentId predicate and uses it for both initialData and the stream map, so the two can no longer diverge.

Breaking-change verdict: behavioral fix only — no signature changes, not source-breaking, no opt-out needed (nothing can reasonably depend on the transient wrong-user flash).

Testing: extended the existing 'it only shows typing users matching its parentId' widget test to mount the indicator with a pre-existing main-channel typing event and assert the first frame shows nothing. Verified the new assertion fails without the fix. Also manually verified in the sample app (thread header no longer flashes main-channel typers).

Screenshots / Videos

No UI changes (the fix removes a transient first-frame flash of wrong typing users; steady-state UI is unchanged).

Summary by CodeRabbit

  • Bug Fixes
    • Fixed the typing indicator so it only displays users typing in the current channel or thread context.
    • Prevented typing users from briefly showing from the wrong context on the indicator’s first frame by applying consistent filtering to both initial and live updates.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ebb8e179-8a4d-46b7-86e4-eca245c790ae

📥 Commits

Reviewing files that changed from the base of the PR and between 1fe313a and f7c0388.

📒 Files selected for processing (1)
  • packages/stream_chat_flutter/CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/stream_chat_flutter/CHANGELOG.md

📝 Walkthrough

Walkthrough

StreamTypingIndicator now filters typing events by parentId during initial rendering and subsequent stream updates. Tests cover pre-existing main-channel events in thread indicators, and the changelog documents the first-frame fix.

Changes

Typing context filtering

Layer / File(s) Summary
Context-aware indicator filtering
packages/stream_chat_flutter/lib/src/indicators/typing_indicator.dart, packages/stream_chat_flutter/test/src/indicators/typing_indicator_test.dart, packages/stream_chat_flutter/CHANGELOG.md
The indicator uses shared parentId filtering for initial and streamed typing events, with regression coverage confirming main-channel events are excluded from the first rendered thread frame and a corresponding changelog entry.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: xsahil03x

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: filtering StreamTypingIndicator's initial data by parentId.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/FLU-614_typing_indicator_initial_data_parent_id

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@VelikovPetar
VelikovPetar marked this pull request as ready for review July 23, 2026 11:35
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.71%. Comparing base (6cb8195) to head (f7c0388).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2842   +/-   ##
=======================================
  Coverage   71.71%   71.71%           
=======================================
  Files         426      426           
  Lines       26891    26892    +1     
=======================================
+ Hits        19285    19286    +1     
  Misses       7606     7606           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


// Keeps only the users typing in the same context as this indicator: the
// thread identified by [parentId], or the main channel when it's null.
Iterable<User> _typingUsers(Map<User, Event> typingEvents) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lets just switch to returning a List instead of Iterable, it will make it a bit performant as we are also converting them to list everytime we compare the data.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in: 1fe313a

VelikovPetar and others added 2 commits July 23, 2026 14:40
Return a List instead of a lazy Iterable from _typingUsers so the
where/map filter runs once per event, and compare the typing user ids
with IterableEquality to drop the throwaway list allocation the
comparator did on every typing event.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@VelikovPetar
VelikovPetar merged commit c0e51d9 into master Jul 23, 2026
28 checks passed
@VelikovPetar
VelikovPetar deleted the fix/FLU-614_typing_indicator_initial_data_parent_id branch July 23, 2026 14:55
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.

2 participants