mirror of
https://github.com/mattermost/focalboard.git
synced 2025-01-23 18:34:02 +02:00
updating date when prop has changed
This commit is contained in:
parent
098868387e
commit
5b1c53dffa
@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
import React, {useMemo, useState, useCallback} from 'react'
|
||||
import React, {useMemo, useState, useCallback, useEffect} from 'react'
|
||||
import {useIntl} from 'react-intl'
|
||||
import {DateUtils} from 'react-day-picker'
|
||||
import MomentLocaleUtils from 'react-day-picker/moment'
|
||||
@ -58,6 +58,12 @@ function DateRange(props: PropertyProps): JSX.Element {
|
||||
const [value, setValue] = useState(propertyValue)
|
||||
const intl = useIntl()
|
||||
|
||||
useEffect(() => {
|
||||
if (value !== propertyValue) {
|
||||
setValue(propertyValue)
|
||||
}
|
||||
}, [propertyValue, setValue])
|
||||
|
||||
const onChange = useCallback((newValue) => {
|
||||
if (value !== newValue) {
|
||||
setValue(newValue)
|
||||
|
Loading…
x
Reference in New Issue
Block a user