Skip to content

Commit

Permalink
make sure not to setDate with prop update when the prop is same date …
Browse files Browse the repository at this point in the history
…to prevent unwanted side effects (wix#2215)
  • Loading branch information
yuvalsho authored Apr 16, 2023
1 parent e79ae52 commit 3f1348c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/expandableCalendar/Context/Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface CalendarContextProviderProps extends ViewProps {
onDateChanged?: (date: string, updateSource: UpdateSources) => void;
/** Callback for month change event */
onMonthChange?: (date: DateData, updateSource: UpdateSources) => void;

/** Whether to show the today button */
showTodayButton?: boolean;
/** Today button's top position */
Expand All @@ -32,7 +32,7 @@ export interface CalendarContextProviderProps extends ViewProps {
todayButtonStyle?: ViewStyle;
/** The opacity for the disabled today button (0-1) */
disabledOpacity?: number;

/** The number of days to present in the timeline calendar */
numberOfDays?: number;
/** The left inset of the timeline calendar (sidebar width), default is 72 */
Expand Down Expand Up @@ -70,7 +70,7 @@ const CalendarProvider = (props: CalendarContextProviderProps) => {
}, [style, propsStyle]);

useDidUpdate(() => {
if (date) {
if (date && date !== currentDate) {
_setDate(date, UpdateSources.PROP_UPDATE);
}
}, [date]);
Expand Down

0 comments on commit 3f1348c

Please sign in to comment.