mirror of
https://github.com/stolksdorf/homebrewery.git
synced 2025-12-21 06:11:30 +00:00
HomebrewAdmin: Remove direct React state mutation.
This commit is contained in:
@@ -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
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user