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 b16427c95e8c255d9dee598d60effbd87997a11f
parent 3336877933541394d60672ae2bfecdf4ab88c888
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Tue,  4 Apr 2023 23:25:38 +0200

feat: cleanup ratings subscription

Diffstat:
Msrc/Leaderboard.js | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/Leaderboard.js b/src/Leaderboard.js @@ -207,8 +207,8 @@ function Leaderboard() { useEffect(() => { // subscribe to ratings from judges and - const channel = supabase.channel('ratings') - channel.on( + const ratingsChannel = supabase.channel('ratings') + ratingsChannel.on( 'postgres_changes', { event: '*', @@ -220,6 +220,11 @@ function Leaderboard() { setLeaderboard(ratingSummary) } ).subscribe() + + // remove subscription + return function cleanup() { + supabase.removeChannel(ratingsChannel) + } }, [heatSelection]); return (