From 14f54e6623485074730e4f0f5d3fff94546c4c57 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Tue, 3 Feb 2026 15:01:50 +0100 Subject: [PATCH] rosary: fix mystery selection lost when excluding luminous 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. --- .../[rosary=rosaryLang]/+page.svelte | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/routes/[faithLang=faithLang]/[rosary=rosaryLang]/+page.svelte b/src/routes/[faithLang=faithLang]/[rosary=rosaryLang]/+page.svelte index 8348e8f..0f5bc37 100644 --- a/src/routes/[faithLang=faithLang]/[rosary=rosaryLang]/+page.svelte +++ b/src/routes/[faithLang=faithLang]/[rosary=rosaryLang]/+page.svelte @@ -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 {