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;
|
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 -->
|
||||||
|
|||||||
Reference in New Issue
Block a user