Skip to content

Commit

Permalink
Shallow clone state before updating to avoid mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gudahtt committed May 8, 2020
1 parent e9bb114 commit 82fec4f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/scripts/controllers/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export default class AlertController {
}

setAlertEnabledness (alertId, enabledness) {
const { alertEnabledness } = this.store.getState()
let { alertEnabledness } = this.store.getState()
alertEnabledness = { ...alertEnabledness }
alertEnabledness[alertId] = enabledness
this.store.updateState({ alertEnabledness })
}
Expand Down

0 comments on commit 82fec4f

Please sign in to comment.