From 6a49c361a05d7bf72c7847237a8e394e5677eb7b Mon Sep 17 00:00:00 2001 From: metamethods Date: Fri, 3 Jan 2025 01:23:11 -0800 Subject: [PATCH] feat: sync active room players --- src/lib/Room.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/Room.svelte b/src/lib/Room.svelte index 1de15bf..9f0ac1e 100644 --- a/src/lib/Room.svelte +++ b/src/lib/Room.svelte @@ -12,6 +12,7 @@ let { room }: { room: Room } = $props(); let roomTimer = $state(room.secondsRemaining); + let players = $state(room.players); onMount(() => { if (!room.finished) { @@ -29,7 +30,9 @@ .get(`/api/room/${room.roomId}`) .then((result) => result.data); roomTimer = updatedRoom.secondsRemaining; + players = updatedRoom.players; if (updatedRoom.finished) { + console.log('killing invervals'); clearInterval(roomTimerUpdateInterval); clearInterval(roomTimerSyncInterval); } @@ -69,7 +72,7 @@

- {#each room.players as player} + {#each players as player} {/each}