Skip to content

fix(llc, core, ui, localization): hide raw StreamChannel errors behind themed, connection-aware states - #2849

Merged
xsahil03x merged 2 commits into
v9from
port/master-to-v9/FLU-628_hide-raw-streamchannel-errors
Jul 30, 2026
Merged

fix(llc, core, ui, localization): hide raw StreamChannel errors behind themed, connection-aware states#2849
xsahil03x merged 2 commits into
v9from
port/master-to-v9/FLU-628_hide-raw-streamchannel-errors

Conversation

@xsahil03x

Copy link
Copy Markdown
Member

FLU-628

Port of #2846 to v9.

Raw StreamChannel initialization errors — and the default list/scroll-view error states — were leaking unthemed, unlocalized error details to end users. This routes them through themed, localized, connection-aware default states (no internet / slow connection / generic), overridable at every level.

What changed

stream_chat

  • Add StreamChatNetworkError.type (StreamChatNetworkErrorType) exposing the transport failure kind; deprecate isRequestCancelledError in favor of type == StreamChatNetworkErrorType.cancel.
  • A failed channel initialization no longer leaves Channel.initialized errored or its name/image/extraData setters throwing — a subsequent successful (re)init recovers cleanly (supports the retry flow).
  • Clearer toString() for StreamWebSocketError / StreamChatNetworkError.

stream_chat_flutter_core

  • Add StreamChannelState.retry() to re-run a failed channel init.
  • Add DefaultStreamChannelBuilders, an inherited widget supplying default loading/error builders to descendant StreamChannels.
  • The default StreamChannel error state no longer exposes raw error details.

stream_chat_flutter

  • StreamChat now installs themed, connection-aware default loading & error states for StreamChannel — overridable per-StreamChannel or via DefaultStreamChannelBuilders.
  • Default list/scroll-view error states (channel, message, member, user, thread, poll-vote, search, photo) are now connection-aware, falling back to each view's specific error text.
  • StreamScrollViewErrorWidget gains errorSubtitle (+ style), defaulting to the generic localized copy.

stream_chat_localizations

  • New connection-error strings (connectionError*, slowConnectionError*, genericError*) for all supported locales.

Port notes — differences from #2846

The original PR targets the current master (v10) baseline. This port adapts it to v9:

  • Dart 3.6.2 (v9) vs 3.11 (master): dot-shorthands (.unknown, .cancel, .w600, .symmetric, …) are rewritten as explicit enum/const references, and StreamChatError keeps EquatableMixin (v9's deliberate choice).
  • Design system: the original UI targets v10's new design system (StreamButton, StreamLoadingSpinner, context.streamColorScheme, streamSpacing, icons.*, stream_core_flutter), none of which exist on v9. The scroll-view error widget, the StreamChat default channel loading/error states, and the message-list error state are re-implemented with v9's chatThemeData / ElevatedButton / CircularProgressIndicator / Icons.*.
  • message_list_view: v9's error state is a single styled Text, so it becomes connection-aware via resolveNetworkErrorText(...).title (no subtitle/retry button, matching v9's existing UI).
  • All list-view retry buttons use v9's existing "Retry" default (kept consistent across views); the full-screen StreamChannel error uses "Try Again".

Intentionally omitted (v10-only):

  • The StreamScrollViewLoadingWidget size / StreamLoadingSpinnerSize redesign (depends on v10-only stream_core_flutter); v9 keeps CircularProgressIndicator + height/width.
  • StreamReactionListView — a v10-only component that doesn't exist on v9.
  • The incidental dio version bump.

Testing

  • All four touched package suites pass; dart analyze --fatal-infos clean across all four packages.
  • New tests cover the default channel error/loading states, the retry-clears-stale-error flow, and full localization coverage.
  • The only failing tests locally are pre-existing golden mismatches in unrelated components (voice-recording attachments, list tiles) — local-platform (macOS) noise; CI rasterizes against goldens/ci/, and none of the touched files have golden tests.

🤖 Generated with Claude Code

…d themed, connection-aware states

Port of #2846 to v9.

Adapts the original change to the v9 baseline:
- Dart 3.6.2: dot-shorthands (`.unknown`/`.cancel`/`.w600`, etc.) rewritten
  as explicit enum/const references; `StreamChatError` keeps `EquatableMixin`.
- v9 design system: the scroll-view error widget, `StreamChat` default
  channel loading/error states, and the message-list error state use v9's
  `chatThemeData`/`ElevatedButton`/`CircularProgressIndicator` instead of the
  v10 design-system widgets (`StreamButton`, `StreamLoadingSpinner`, etc.).
- Skipped: the `StreamScrollViewLoadingWidget` `size`/`StreamLoadingSpinnerSize`
  redesign (depends on v10-only `stream_core_flutter`) and the v10-only
  `StreamReactionListView`. The incidental `dio` bump is not included.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f574e978-3530-49e0-9723-04b95e8083d0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch port/master-to-v9/FLU-628_hide-raw-streamchannel-errors

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.

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.41758% with 155 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (v9@b861588). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...c/scroll_view/stream_scroll_view_empty_widget.dart 0.00% 12 Missing ⚠️
.../channel_scroll_view/stream_channel_grid_view.dart 0.00% 10 Missing ⚠️
.../channel_scroll_view/stream_channel_list_view.dart 0.00% 10 Missing ⚠️
...view/draft_scroll_view/stream_draft_list_view.dart 0.00% 10 Missing ⚠️
...ew/member_scroll_view/stream_member_grid_view.dart 0.00% 10 Missing ⚠️
...ew/member_scroll_view/stream_member_list_view.dart 0.00% 10 Missing ⚠️
...h_scroll_view/stream_message_search_grid_view.dart 0.00% 10 Missing ⚠️
...h_scroll_view/stream_message_search_list_view.dart 0.00% 10 Missing ⚠️
...l_vote_scroll_view/stream_poll_vote_list_view.dart 0.00% 10 Missing ⚠️
...ew/thread_scroll_view/stream_thread_list_view.dart 0.00% 10 Missing ⚠️
... and 9 more
Additional details and impacted files
@@          Coverage Diff          @@
##             v9    #2849   +/-   ##
=====================================
  Coverage      ?   67.32%           
=====================================
  Files         ?      431           
  Lines         ?    27370           
  Branches      ?        0           
=====================================
  Hits          ?    18427           
  Misses        ?     8943           
  Partials      ?        0           

☔ 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.

- Refactor StreamScrollViewErrorWidget to v10's extract-to-vars structure
  (icon → effective* values → title/subtitle/retryButton → padded Column),
  adapted to v9's design system.
- Theme the retry button like the poll widgets: OutlinedButton with
  accentPrimary foreground and bodyBold text (matches v10's bodyEmphasis).
- Add outer padding to the empty/loading widgets and mirror v10's structure.
- Color the initial-load and load-more spinners with accentPrimary.
- Make every scroll view's error state connection-aware, including the
  v9-only channel-grid, draft-list and message-search-grid, and pass the
  connection-aware errorSubtitle on all lists.
- Match the core StreamChannel default error state's layout settings to the
  UI widget while keeping colors on Flutter/Material defaults (core has no
  design system).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@xsahil03x
xsahil03x merged commit 952c190 into v9 Jul 30, 2026
24 checks passed
@xsahil03x
xsahil03x deleted the port/master-to-v9/FLU-628_hide-raw-streamchannel-errors branch July 30, 2026 11:30
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