fix(ui, samples): dispose fixes on channel list and avatar - #2876
Conversation
|
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)
📝 WalkthroughWalkthroughThe PR makes ChangesChannel avatar disposal handling
Channel list controller lifecycle
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/stream_chat_flutter/test/src/avatars/stream_channel_avatar_test.dart`:
- Around line 89-102: Update the test around liveState disposal to emit a
membersController value immediately after setting liveState to null, before
incrementing rebuildNotifier and pumping. Keep the subsequent rebuild and
exception assertion separate so the member-stream disposal path is exercised
while the nested BetterStreamBuilder is still mounted.
In `@sample_app/lib/widgets/channel_list.dart`:
- Around line 32-46: Update _initControllers so replacing the search controller
preserves and reloads the existing _controller.text query, keeping active search
results synchronized; alternatively, clear _controller and reset _isSearchActive
before creating the replacement. Ensure the UI does not remain in active-search
mode with an empty replacement query.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 34c19af3-1826-471f-a796-601b93cd74d2
📒 Files selected for processing (3)
packages/stream_chat_flutter/lib/src/components/avatar/stream_channel_avatar.dartpackages/stream_chat_flutter/test/src/avatars/stream_channel_avatar_test.dartsample_app/lib/widgets/channel_list.dart
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2876 +/- ##
==========================================
+ Coverage 73.45% 73.47% +0.01%
==========================================
Files 431 431
Lines 27826 27827 +1
==========================================
+ Hits 20439 20445 +6
+ Misses 7387 7382 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/stream_chat_flutter/test/src/avatars/stream_channel_avatar_test.dart`:
- Around line 92-102: Update the channel.isOneToOne stub in this regression test
to throw when liveState is null, while preserving its true result for active
state. After membersController.add and tester.pump(), assert that
find.byType(StreamUserAvatar) finds nothing, proving the disposed-channel
fallback rendered and the member-stream builder exercised the guard.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 03631ae3-3995-4eac-85cb-f26e824f46db
📒 Files selected for processing (2)
packages/stream_chat_flutter/test/src/avatars/stream_channel_avatar_test.dartsample_app/lib/widgets/channel_list.dart
Submit a pull request
CLA
Description of the pull request
The avatar issue was introduced in: #2827
The issue was not released yet, so no changelog entry needed for this.
The
channel.isOneToOnechecks if the channel state is already disposed and if it is it crashes. This PR adds a channel state check before that.In the ChannelList we have the issue that the
_messageSearchListControllerwas only created inside the dispose method, because of thelate final. Now it's always created indidChangeDependencies.Summary by CodeRabbit
Bug Fixes
Tests