1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-21 04:31:28 +00:00

HomebrewAdmin: Remove direct React state mutation.

This commit is contained in:
Rae Che
2018-05-27 12:22:46 +01:00
committed by Trevor Buckner
parent 74f92f3e44
commit ff0aa56ddc

View File

@@ -38,9 +38,10 @@ const HomebrewAdmin = createClass({
}) })
.end((err, res)=>{ .end((err, res)=>{
if(err || !res.body || !res.body.brews) return; if(err || !res.body || !res.body.brews) return;
this.state.brewCache[page] = res.body.brews; const newCache = _.extend({}, this.state.brewCache);
newCache[page] = res.body.brews;
this.setState({ this.setState({
brewCache : this.state.brewCache, brewCache : newCache,
total : res.body.total, total : res.body.total,
count : res.body.count count : res.body.count
}); });