add debug log for DateField
parent
2e18a46550
commit
7ccb1716c5
|
@ -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<Date | undefined>(defaultSelected)
|
||||
useEffect(() => {
|
||||
if (
|
||||
typeof defaultSelected !== 'undefined' &&
|
||||
oldDefaultSelected.current?.getTime() !== defaultSelected.getTime()
|
||||
) {
|
||||
console.log('DateField useEffect loop ?')
|
||||
handleDaySelect(defaultSelected)
|
||||
oldDefaultSelected.current = defaultSelected
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue