mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-09 02:52:38 +00:00
PrintPage: Fix potentially inconsistent React state update
This commit is contained in:
@@ -22,7 +22,9 @@ const PrintPage = createClass({
|
|||||||
|
|
||||||
componentDidMount : function() {
|
componentDidMount : function() {
|
||||||
if(this.props.query.local){
|
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();
|
if(this.props.query.dialog) window.print();
|
||||||
|
|||||||
Reference in New Issue
Block a user