diff --git a/khelo/lib/ui/flow/tournament/detail/tournament_detail_view_model.dart b/khelo/lib/ui/flow/tournament/detail/tournament_detail_view_model.dart index 3fed1852..c6287892 100644 --- a/khelo/lib/ui/flow/tournament/detail/tournament_detail_view_model.dart +++ b/khelo/lib/ui/flow/tournament/detail/tournament_detail_view_model.dart @@ -59,7 +59,10 @@ class TournamentDetailStateViewNotifier final teamStats = data.$2; final keyStats = data.$3.getTopKeyStats(); - _matchService.streamMatchesByIds(tournament.match_ids).listen((matches) { + _matchSubscription?.cancel(); + _matchSubscription = _matchService + .streamMatchesByIds(tournament.match_ids) + .listen((matches) { state = state.copyWith( tournament: tournament, teamStats: teamStats, diff --git a/khelo/lib/ui/flow/tournament/match_selection/match_selection_view_model.dart b/khelo/lib/ui/flow/tournament/match_selection/match_selection_view_model.dart index b17e6a2c..0848560a 100644 --- a/khelo/lib/ui/flow/tournament/match_selection/match_selection_view_model.dart +++ b/khelo/lib/ui/flow/tournament/match_selection/match_selection_view_model.dart @@ -41,13 +41,13 @@ class MatchSelectionViewNotifier extends StateNotifier { void loadTournament() async { if (_tournamentId == null) return; _tournamentSubscription?.cancel(); - _matchSubscription?.cancel(); state = state.copyWith(loading: true); _tournamentSubscription = _tournamentService .streamTournamentById(_tournamentId!) .listen((tournament) async { + _matchSubscription?.cancel(); _matchSubscription = _matchService .streamMatchesByIds(tournament.match_ids) .listen((matches) {