diff --git a/frontend/src/components/calendar/CalendarPage.tsx b/frontend/src/components/calendar/CalendarPage.tsx index fbf4a9f..cde92b4 100644 --- a/frontend/src/components/calendar/CalendarPage.tsx +++ b/frontend/src/components/calendar/CalendarPage.tsx @@ -613,7 +613,7 @@ export default function CalendarPage() { setMobileSidebarOpen(false)} /> - { setMobileSidebarOpen(false); handleUseTemplate(tmpl); }} onSharedVisibilityChange={setVisibleSharedIds} width={288} onDateClick={handleMiniCalClick} currentDate={currentDate} firstDayOfWeek={firstDayOfWeek} navKey={navKey} /> + { setMobileSidebarOpen(false); handleUseTemplate(tmpl); }} onSharedVisibilityChange={setVisibleSharedIds} width={288} onDateClick={(dateStr) => { setMobileSidebarOpen(false); handleMiniCalClick(dateStr); }} currentDate={currentDate} firstDayOfWeek={firstDayOfWeek} navKey={navKey} /> )} diff --git a/frontend/src/components/calendar/MiniCalendar.tsx b/frontend/src/components/calendar/MiniCalendar.tsx index 369793c..2fa3147 100644 --- a/frontend/src/components/calendar/MiniCalendar.tsx +++ b/frontend/src/components/calendar/MiniCalendar.tsx @@ -77,12 +77,9 @@ const MiniCalendar = memo(function MiniCalendar({ const handleDayClick = useCallback((day: Date) => { const dateStr = format(day, 'yyyy-MM-dd'); setSelectedDate(dateStr); - // If clicking a day in another month, also shift the displayed month - if (!isSameMonth(day, displayedMonth)) { - setDisplayedMonth(startOfMonth(day)); - } + setDisplayedMonth((prev) => isSameMonth(day, prev) ? prev : startOfMonth(day)); onDateClick(dateStr); - }, [displayedMonth, onDateClick]); + }, [onDateClick]); const selectedDateObj = useMemo( () => selectedDate ? parseDate(selectedDate) : null, @@ -137,6 +134,7 @@ const MiniCalendar = memo(function MiniCalendar({