Skip to content

Commit

Permalink
Fix deadlock on rendering with usePickerState
Browse files Browse the repository at this point in the history
  • Loading branch information
dmtrKovalenko committed Jun 8, 2019
1 parent 09da0b7 commit 04773f1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/src/_shared/hooks/usePickerState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ export function usePickerState(props: BasePickerProps, options: StateHookOptions

useEffect(() => {
// if value was changed in closed state - treat it as accepted
if (!isOpen) {
if (!isOpen && !utils.isEqual(pickerDate, date)) {
setPickerDate(date);
}
}, [date, isOpen]);
}, [date, isOpen, pickerDate, utils]);

const acceptDate = useCallback(
(acceptedDate: MaterialUiPickersDate) => {
Expand Down

0 comments on commit 04773f1

Please sign in to comment.