rosary: fix mystery selection lost when excluding luminous
All checks were successful
CI / update (push) Successful in 1m32s

The on:change handler on the Toggle component was silently ignored
since Toggle is a Svelte 5 component that doesn't support the Svelte 4
event directive. Replace with a reactive $effect that reverts to
today's mystery when luminous is excluded while selected.
This commit is contained in:
2026-02-03 15:01:50 +01:00
parent e8b0fb7d9d
commit 14f54e6623

View File

@@ -286,13 +286,13 @@ function selectMystery(mysteryType) {
selectedMystery = mysteryType; selectedMystery = mysteryType;
} }
// Function to handle toggle change // When luminous toggle changes, update today's mystery and fix invalid selection
function handleToggleChange() { $effect(() => {
// Recalculate the default mystery for today
todaysMystery = getMysteryForWeekday(new Date(), includeLuminous); todaysMystery = getMysteryForWeekday(new Date(), includeLuminous);
// Update to today's mystery if (!includeLuminous && selectedMystery === 'lichtreichen') {
selectMystery(todaysMystery); selectedMystery = todaysMystery;
} }
});
// Active section tracking // Active section tracking
let activeSection = $state("cross"); let activeSection = $state("cross");
@@ -1290,7 +1290,6 @@ h1 {
<Toggle <Toggle
bind:checked={includeLuminous} bind:checked={includeLuminous}
label={labels.includeLuminous} label={labels.includeLuminous}
on:change={handleToggleChange}
/> />
<!-- Language Toggle --> <!-- Language Toggle -->