Skip to content

Commit

Permalink
fix(DatePicker): onChange callback not being called (carbon-design-sy…
Browse files Browse the repository at this point in the history
…stem#13774)

* fix: onChange callback not being called

add undefined as useSavedCallback param type and remove arrow func param

* fix(DatePicker): fix code format with prettier

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and tay1orjones committed May 12, 2023
1 parent 044bb55 commit 8c77ad5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions packages/react/src/components/DatePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,9 @@ const DatePicker = React.forwardRef(function DatePicker(
});
};

//const savedOnOpen = useSavedCallback(onOpen);
const endInputField = useRef<HTMLTextAreaElement>(null);
const calendarRef: any | undefined = useRef(null);
const savedOnChange = useSavedCallback(() => onChange);
const savedOnChange = useSavedCallback(onChange);
const savedOnClose = useSavedCallback(
datePickerType === 'range' ? onCalendarClose : onClose
);
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/internal/useSavedCallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 8c77ad5

Please sign in to comment.