Skip to content

Commit cab7a33

Browse files
fix(lightning): ensure lightning round display syncs with host control
- Add lightning-refresh event handler to reload game data - Listen for lightning-next-question broadcast to update display - Properly reload lightning questions from database on refresh - Ensure display updates when host advances to next question
1 parent 2348cc8 commit cab7a33

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

app/Livewire/LightningRound.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ public function handleGameStateChanged($state, $data = [])
8282
{
8383
if ($state === 'buzzer-pressed' && isset($data['teamId'])) {
8484
$this->handleBuzzer($data['teamId']);
85+
} elseif ($state === 'lightning-next-question') {
86+
// Refresh when host moves to next question
87+
$this->handleRefresh();
8588
}
8689
}
8790

@@ -108,6 +111,14 @@ public function handleNextQuestion()
108111
{
109112
$this->nextQuestion();
110113
}
114+
115+
#[On('lightning-refresh')]
116+
public function handleRefresh()
117+
{
118+
// Reload the game with fresh lightning questions
119+
$this->game = Game::with('lightningQuestions', 'teams')->findOrFail($this->game->id);
120+
$this->loadCurrentQuestion();
121+
}
111122

112123
public function markLightningCorrect()
113124
{

0 commit comments

Comments
 (0)