fix: reactivity bug
This commit is contained in:
parent
6a49c361a0
commit
fc34acda82
@ -12,7 +12,6 @@
|
|||||||
let { room }: { room: Room } = $props();
|
let { room }: { room: Room } = $props();
|
||||||
|
|
||||||
let roomTimer = $state(room.secondsRemaining);
|
let roomTimer = $state(room.secondsRemaining);
|
||||||
let players = $state(room.players);
|
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
if (!room.finished) {
|
if (!room.finished) {
|
||||||
@ -30,7 +29,7 @@
|
|||||||
.get<Room>(`/api/room/${room.roomId}`)
|
.get<Room>(`/api/room/${room.roomId}`)
|
||||||
.then((result) => result.data);
|
.then((result) => result.data);
|
||||||
roomTimer = updatedRoom.secondsRemaining;
|
roomTimer = updatedRoom.secondsRemaining;
|
||||||
players = updatedRoom.players;
|
room.players = updatedRoom.players;
|
||||||
if (updatedRoom.finished) {
|
if (updatedRoom.finished) {
|
||||||
console.log('killing invervals');
|
console.log('killing invervals');
|
||||||
clearInterval(roomTimerUpdateInterval);
|
clearInterval(roomTimerUpdateInterval);
|
||||||
@ -72,7 +71,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 sm:grid-rows-2">
|
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 sm:grid-rows-2">
|
||||||
{#each players as player}
|
{#each room.players as player}
|
||||||
<Player {player} />
|
<Player {player} />
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user