From 0c2b075d6512dc537439bd3962014769c1eb8809 Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Sun, 16 Jan 2022 08:50:42 -0500 Subject: [PATCH] fix: prevent medals changing due to async match history (#167) --- app/Http/Livewire/GamePage.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Livewire/GamePage.php b/app/Http/Livewire/GamePage.php index 7199649a..6d27db74 100644 --- a/app/Http/Livewire/GamePage.php +++ b/app/Http/Livewire/GamePage.php @@ -24,8 +24,8 @@ public function render(): View { $groupedPlayers = $this->game->players->groupBy('game_team_id'); - $this->game->players - ->each(function (GamePlayer $gamePlayer) { + if (! $this->game->outdated) { + $this->game->players->each(function (GamePlayer $gamePlayer) { $gamePlayer->hydrated_medals->filter(function (Medal $medal) { return $medal->type->in([ MedalType::LEGENDARY(), @@ -40,6 +40,7 @@ public function render(): View $this->powerfulMedals[$medal->id]['players'][$gamePlayer->id] = $gamePlayer; }); }); + } return view('livewire.game-page', [ 'game' => $this->game,