From ff0aa56ddc5151374d63a1cfc60cc0840236331b Mon Sep 17 00:00:00 2001 From: Rae Che Date: Sun, 27 May 2018 12:22:46 +0100 Subject: [PATCH] HomebrewAdmin: Remove direct React state mutation. --- client/admin/homebrewAdmin/homebrewAdmin.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/admin/homebrewAdmin/homebrewAdmin.jsx b/client/admin/homebrewAdmin/homebrewAdmin.jsx index 094bd9a..3b40aba 100644 --- a/client/admin/homebrewAdmin/homebrewAdmin.jsx +++ b/client/admin/homebrewAdmin/homebrewAdmin.jsx @@ -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 });