From e86ce5cf0621d00ff5981500af1b38e18e155f21 Mon Sep 17 00:00:00 2001 From: Rae Che Date: Sun, 27 May 2018 14:01:47 +0100 Subject: [PATCH] PrintPage: Fix potentially inconsistent React state update --- client/homebrew/pages/printPage/printPage.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/homebrew/pages/printPage/printPage.jsx b/client/homebrew/pages/printPage/printPage.jsx index 8facee397..13510f7a9 100644 --- a/client/homebrew/pages/printPage/printPage.jsx +++ b/client/homebrew/pages/printPage/printPage.jsx @@ -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();