diff --git a/packages/react/src/components/DatePicker/DatePicker.tsx b/packages/react/src/components/DatePicker/DatePicker.tsx index 37b1e5a189b7..92f6047d22f6 100644 --- a/packages/react/src/components/DatePicker/DatePicker.tsx +++ b/packages/react/src/components/DatePicker/DatePicker.tsx @@ -462,10 +462,9 @@ const DatePicker = React.forwardRef(function DatePicker( }); }; - //const savedOnOpen = useSavedCallback(onOpen); const endInputField = useRef(null); const calendarRef: any | undefined = useRef(null); - const savedOnChange = useSavedCallback(() => onChange); + const savedOnChange = useSavedCallback(onChange); const savedOnClose = useSavedCallback( datePickerType === 'range' ? onCalendarClose : onClose ); diff --git a/packages/react/src/internal/useSavedCallback.js b/packages/react/src/internal/useSavedCallback.js index 5eab87efa181..f7c1a37bf48b 100644 --- a/packages/react/src/internal/useSavedCallback.js +++ b/packages/react/src/internal/useSavedCallback.js @@ -13,7 +13,7 @@ import { useCallback, useEffect, useRef } from 'react'; * callback prop but don't want it to be added to the dependency array of an * effect. * - * @param {Function} callback + * @param {Function | undefined} callback * @returns {Function} */ export function useSavedCallback(callback) {