myheats

Live heats, scoring and leaderboard for sport events
git clone https://git.in0rdr.ch/myheats.git
Log | Files | Refs | Pull requests | README | LICENSE

commit 084f41ef32b19bdb448f9f6c8a98852bf30f4e52
parent c4616b82c3bbe2f9ab21f638c682c859a70b793d
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Tue, 14 Mar 2023 19:08:48 +0100

fix(realtime): not updating on changes

Diffstat:
Msrc/Leaderboard.js | 22+++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/Leaderboard.js b/src/Leaderboard.js @@ -160,17 +160,6 @@ function Leaderboard() { } ]) - useEffect(() => { - (async () => { - let heatList = {data: []} - heatList = await supabase.from('heats').select() - setHeats(heatList.data) - - let ratingSummary = await getRatingSummary(heatSelection.map(h => h.value)) - setLeaderboard(ratingSummary) - })(); - }, [heatSelection]); - // subscribe to ratings from judges and // reload all ratings to refresh leaderboard const channel = supabase.channel('ratings') @@ -186,6 +175,17 @@ function Leaderboard() { } ).subscribe() + useEffect(() => { + (async () => { + let heatList = {data: []} + heatList = await supabase.from('heats').select() + setHeats(heatList.data) + + let ratingSummary = await getRatingSummary(heatSelection.map(h => h.value)) + setLeaderboard(ratingSummary) + })(); + }, [heatSelection, leaderboard]); + return ( <div className="Leaderboard"> <header>