1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-16 04:05:57 +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)=>{
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({
brewCache : this.state.brewCache,
brewCache : newCache,
total : res.body.total,
count : res.body.count
});