rosary: fix mystery selection lost when excluding luminous
All checks were successful
CI / update (push) Successful in 1m32s
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:
@@ -286,13 +286,13 @@ function selectMystery(mysteryType) {
|
||||
selectedMystery = mysteryType;
|
||||
}
|
||||
|
||||
// Function to handle toggle change
|
||||
function handleToggleChange() {
|
||||
// Recalculate the default mystery for today
|
||||
// When luminous toggle changes, update today's mystery and fix invalid selection
|
||||
$effect(() => {
|
||||
todaysMystery = getMysteryForWeekday(new Date(), includeLuminous);
|
||||
// Update to today's mystery
|
||||
selectMystery(todaysMystery);
|
||||
if (!includeLuminous && selectedMystery === 'lichtreichen') {
|
||||
selectedMystery = todaysMystery;
|
||||
}
|
||||
});
|
||||
|
||||
// Active section tracking
|
||||
let activeSection = $state("cross");
|
||||
@@ -1290,7 +1290,6 @@ h1 {
|
||||
<Toggle
|
||||
bind:checked={includeLuminous}
|
||||
label={labels.includeLuminous}
|
||||
on:change={handleToggleChange}
|
||||
/>
|
||||
|
||||
<!-- Language Toggle -->
|
||||
|
||||
Reference in New Issue
Block a user