Skip to content

Commit fecbf4d

Browse files
committed
fix(DatePicker): strictmode issue preventing value from updating
fixes #1074
1 parent debfb8f commit fecbf4d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/react-widgets/src/DatePickerInput.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ const DatePickerInput = React.forwardRef(
5050
[value, formatter, localizer, displayFormat, editing, editFormat],
5151
)
5252

53-
const lastValueFromProps = useRef(nextTextValue)
53+
const [prevValue, setPrevValue] = useState(nextTextValue)
5454
const [textValue, setTextValue] = useState(nextTextValue)
5555

56-
if (lastValueFromProps.current !== nextTextValue) {
57-
lastValueFromProps.current = nextTextValue
56+
if (prevValue !== nextTextValue) {
57+
setPrevValue(nextTextValue)
5858
setTextValue(nextTextValue)
5959
}
6060

0 commit comments

Comments
 (0)