Fix track coloring hover: inline reactive vars so Svelte tracks deps

statColorMode() hid hasSpeedTrack etc. from Svelte's compiler so the
{#each} block never re-rendered when timeseries loaded. Inline the
ternary directly so all reactive variables are visible to the tracker.
This commit is contained in:
Davide Scaini
2026-05-16 22:56:20 +02:00
parent 1cca485062
commit 0dc450ba30
+6 -1
View File
@@ -407,7 +407,12 @@
<!-- Stats panel --> <!-- Stats panel -->
<div class="grid grid-cols-2 lg:grid-cols-1 gap-px bg-zinc-800 rounded-xl overflow-hidden"> <div class="grid grid-cols-2 lg:grid-cols-1 gap-px bg-zinc-800 rounded-xl overflow-hidden">
{#each stats as s} {#each stats as s}
{@const cm = statColorMode(s.key)} {@const cm =
s.key === 'speed' && hasSpeedTrack ? 'speed' :
s.key === 'heart_rate' && hasHrTrack ? 'hr' :
s.key === 'power' && hasPowerTrack ? 'power' :
s.key === 'elevation' && hasElevTrack ? 'elevation' :
s.key === 'cadence' && hasCadenceTrack ? 'cadence' : null}
<div <div
class="bg-zinc-900 px-4 py-3 transition-colors" class="bg-zinc-900 px-4 py-3 transition-colors"
class:hover:bg-zinc-800={cm !== null} class:hover:bg-zinc-800={cm !== null}