fix(ui): filter StreamTypingIndicator initial data by parentId#2842
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesTyping context filtering
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
|
||
| // 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) { |
There was a problem hiding this comment.
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.
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>
Submit a pull request
Linear: FLU-614
Github Issue: #
CLA
Description of the pull request
StreamTypingIndicatorseeded itsBetterStreamBuilder.initialDatafrom the unfilteredtypingEventsmap, while its stream filters typing events byparentId. 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 300msAnimatedSwitcherfade).This PR extracts a shared
_typingUsershelper that applies theparentIdpredicate and uses it for bothinitialDataand the streammap, 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