fix(dashboard): handle balance-stream errors instead of freezing the balance#675
Open
joshuakrueger-dfx wants to merge 1 commit into
Open
Conversation
…balance
BalanceCubit subscribed with watchBalance(...).listen(emit) and no onError, so
a stream error escaped as an unhandled async error and the balance silently
froze with no recovery. Add an onError handler that logs the failure; with
cancelOnError defaulting to false the subscription stays alive, so later
balances still update the UI.
Regression: test/screens/dashboard/balance_cubit_test.dart
("a stream error is handled ... and later balances still update")
Issue RealUnitCH#657 — Part 3, finding RealUnitCH#14.
d1dc2b2 to
bebdb88
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses Issue #657 — Part 3, finding #14.
Problem
BalanceCubitusedwatchBalance(...).listen(emit)with noonError— a stream error escaped as an unhandled async error and the balance silently froze with no recovery.Fix
Add an
onErrorhandler that logs the failure.cancelOnErrordefaults tofalse, so the subscription stays alive and later balances still update the UI.Tests (RED→GREEN, proven)
New regression: a
addErroron the stream must not fail as unhandled, and a balance pushed afterwards still updates the state — fails on the old code (verified), passes with the fix. Suite green (5/5),flutter analyzeclean.🤖 Big Brother fleet confirmed the defect (Design-Skeptic PASS); hand-finished by operator (fleet Inspector-cap-stopped). Ref #657.