Skip to content

Commit 3f1348c

Browse files
authored
make sure not to setDate with prop update when the prop is same date to prevent unwanted side effects (#2215)
1 parent e79ae52 commit 3f1348c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/expandableCalendar/Context/Provider.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface CalendarContextProviderProps extends ViewProps {
2323
onDateChanged?: (date: string, updateSource: UpdateSources) => void;
2424
/** Callback for month change event */
2525
onMonthChange?: (date: DateData, updateSource: UpdateSources) => void;
26-
26+
2727
/** Whether to show the today button */
2828
showTodayButton?: boolean;
2929
/** Today button's top position */
@@ -32,7 +32,7 @@ export interface CalendarContextProviderProps extends ViewProps {
3232
todayButtonStyle?: ViewStyle;
3333
/** The opacity for the disabled today button (0-1) */
3434
disabledOpacity?: number;
35-
35+
3636
/** The number of days to present in the timeline calendar */
3737
numberOfDays?: number;
3838
/** The left inset of the timeline calendar (sidebar width), default is 72 */
@@ -70,7 +70,7 @@ const CalendarProvider = (props: CalendarContextProviderProps) => {
7070
}, [style, propsStyle]);
7171

7272
useDidUpdate(() => {
73-
if (date) {
73+
if (date && date !== currentDate) {
7474
_setDate(date, UpdateSources.PROP_UPDATE);
7575
}
7676
}, [date]);

0 commit comments

Comments
 (0)