From d8987f2d3abd4ae02d11859b365a0e38d2464425 Mon Sep 17 00:00:00 2001 From: Mayank Variya Date: Tue, 10 Dec 2024 15:45:02 +0530 Subject: [PATCH] Mr changes --- .../flow/tournament/detail/tournament_detail_view_model.dart | 5 ++++- .../match_selection/match_selection_view_model.dart | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) 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) {