diff --git a/CHANGELOG.md b/CHANGELOG.md index e6dfc042dd5..e44b8710ac8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Fixed typo to correct `aria-modal` attribute in`EuiPopover` ([#2488](https://github.com/elastic/eui/pull/2488)) - Fixed position of `EuiCodeBlock` controls and added more tests ([#2459](https://github.com/elastic/eui/pull/2459)) - Changed `EuiCodeBlock` so that `overflowHeight` now applies a `maxHeight` instead of a `height` on the block ([#2487](https://github.com/elastic/eui/pull/2487)) +- Fixed potentially inconsistent state update ([#2481](https://github.com/elastic/eui/pull/2481)) ## [`14.8.0`](https://github.com/elastic/eui/tree/v14.8.0) diff --git a/packages/react-datepicker/src/time.jsx b/packages/react-datepicker/src/time.jsx index 68157330640..9e098d268bc 100644 --- a/packages/react-datepicker/src/time.jsx +++ b/packages/react-datepicker/src/time.jsx @@ -122,9 +122,9 @@ export default class Time extends React.Component { } // update preSelection to the selection - this.setState({ - preSelection: this.props.selected, - }); + this.setState(prevState => ({ + preSelection: prevState.selected, + })); } if (this.state.needsScrollToPreSelection) {