From 7ccb1716c5716ee89f5fc652b43b263b7bd5181a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Rialland?= Date: Mon, 25 Sep 2023 20:02:37 +0200 Subject: [PATCH] add debug log for DateField --- site/source/design-system/field/DateField.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/site/source/design-system/field/DateField.tsx b/site/source/design-system/field/DateField.tsx index 3f15ad16d..2c856288c 100644 --- a/site/source/design-system/field/DateField.tsx +++ b/site/source/design-system/field/DateField.tsx @@ -86,6 +86,8 @@ export default function DateField(props: DateFieldProps) { }, [refs.reference]) const handleInputChange = (value: string) => { + console.log('DateField handleInputChange', value) + setIsOpen(false) setIsChangeOnce(true) setInputValue(value) @@ -109,6 +111,8 @@ export default function DateField(props: DateFieldProps) { const handleDaySelect = useCallback( (date?: Date) => { + console.log('DateField handleDaySelect', date) + setSelected(date) if (date) { const value = formatDate(date, format) @@ -123,12 +127,21 @@ export default function DateField(props: DateFieldProps) { [close, onChange] ) + useEffect(() => { + console.log('DateField mounted') + + return () => { + console.log('DateField unmounted') + } + }, []) + const oldDefaultSelected = useRef(defaultSelected) useEffect(() => { if ( typeof defaultSelected !== 'undefined' && oldDefaultSelected.current?.getTime() !== defaultSelected.getTime() ) { + console.log('DateField useEffect loop ?') handleDaySelect(defaultSelected) oldDefaultSelected.current = defaultSelected }