Skip to content

Commit

Permalink
Fixed potentially inconsistent state update #2481 (#2499)
Browse files Browse the repository at this point in the history
* Fixed potentially inconsistent state update

Use callback parameter to calculate state when update is about to be performed.

* Fixed potentially inconsistent state update

Use callback parameter to calculate state when update is about to be performed.

* Add bugfixes of PR#2481

* Fixed potentially inconsistent state update

Use callback parameter to calculate state when update is about to be performed.

* Add bugfixes of PR#2481
  • Loading branch information
pedroprado010 authored and thompsongl committed Oct 29, 2019
1 parent b21509d commit d9508fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions packages/react-datepicker/src/time.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit d9508fd

Please sign in to comment.