0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-27 02:52:43 +00:00

PrintPage: Fix potentially inconsistent React state update

This commit is contained in:
Rae Che
2018-05-27 14:01:47 +01:00
committed by Trevor Buckner
parent 8d73ff6833
commit e86ce5cf06

View File

@@ -22,7 +22,9 @@ const PrintPage = createClass({
componentDidMount : function() {
if(this.props.query.local){
this.setState({ brewText: localStorage.getItem(this.props.query.local) });
this.setState((prevState, prevProps) => ({
brewText: localStorage.getItem(prevProps.query.local)
}));
}
if(this.props.query.dialog) window.print();