Skip to content

Commit a1cd1a1

Browse files
authored
Merge pull request #1891 from wix/fix/Day_performance
Day - performance fix
2 parents cbed39c + e120881 commit a1cd1a1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/calendar/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ const Calendar = (props: CalendarProps) => {
102102
}
103103
}, [currentMonth]);
104104

105-
const updateMonth = (newMonth: XDate) => {
105+
const updateMonth = useCallback((newMonth: XDate) => {
106106
if (sameMonth(newMonth, currentMonth)) {
107107
return;
108108
}
109109
setCurrentMonth(newMonth);
110-
};
110+
}, [currentMonth]);
111111

112112
const addMonth = useCallback((count: number) => {
113113
const newMonth = currentMonth.clone().addMonths(count, true);

src/expandableCalendar/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ const ExpandableCalendar = (props: ExpandableCalendarProps) => {
428428
}
429429

430430
onDayPress?.(value);
431-
}, [setDate, onDayPress, closeOnDayPress, isOpen, numberOfDays]);
431+
}, [onDayPress, closeOnDayPress, isOpen, numberOfDays]);
432432

433433
const onVisibleMonthsChange = useCallback(throttle(
434434
(value: DateData[]) => {

0 commit comments

Comments
 (0)