From 44eb5fced25a37f21f1a3057bb46eec31fe12066 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Sun, 19 Apr 2026 15:04:27 +0200 Subject: [PATCH] fix: stop birthday calendar from re-showing after manual hide #204 --- app/[locale]/calendar/page.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/[locale]/calendar/page.tsx b/app/[locale]/calendar/page.tsx index 209dc37d..9d867766 100644 --- a/app/[locale]/calendar/page.tsx +++ b/app/[locale]/calendar/page.tsx @@ -165,9 +165,14 @@ export default function CalendarPage() { return () => clearInterval(interval); }, [client, refreshAllSubscriptions]); - // Auto-add birthday calendar to selected IDs when enabled + // Auto-add birthday calendar to selected IDs only when the setting flips + // off→on. Firing on every mount would undo a user's manual hide via the + // sidebar each time they navigate back to the calendar (see #204). + const prevShowBirthdayRef = useRef(showBirthdayCalendar); useEffect(() => { - if (showBirthdayCalendar && !selectedCalendarIds.includes(BIRTHDAY_CALENDAR_ID)) { + const wasShown = prevShowBirthdayRef.current; + prevShowBirthdayRef.current = showBirthdayCalendar; + if (!wasShown && showBirthdayCalendar && !selectedCalendarIds.includes(BIRTHDAY_CALENDAR_ID)) { toggleCalendarVisibility(BIRTHDAY_CALENDAR_ID); } }, [showBirthdayCalendar]); // eslint-disable-line react-hooks/exhaustive-deps