From 97746777c5a9bfec059e2753307062180c08de3a Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 27 Aug 2018 16:06:26 +0300 Subject: immutability-helper --- vnext/package.json | 1 + vnext/src/components/Settings.js | 24 ++++++++++++++---------- vnext/yarn.lock | 6 ++++++ 3 files changed, 21 insertions(+), 10 deletions(-) (limited to 'vnext') diff --git a/vnext/package.json b/vnext/package.json index 89800abd..5f9de60e 100644 --- a/vnext/package.json +++ b/vnext/package.json @@ -69,6 +69,7 @@ }, "dependencies": { "axios": "^0.18.0", + "immutability-helper": "^2.7.1", "moment": "^2.22.2", "query-string": "^6.1.0", "react": "^16.4.2", diff --git a/vnext/src/components/Settings.js b/vnext/src/components/Settings.js index 2a24e35c..2f03671f 100644 --- a/vnext/src/components/Settings.js +++ b/vnext/src/components/Settings.js @@ -1,5 +1,7 @@ import React from 'react'; +import update from 'immutability-helper'; + import { me } from '../api'; import { UserType } from './Types'; @@ -39,9 +41,11 @@ export default class Settings extends React.Component { console.log('password update'); } emailChanged = (event) => { - this.setState({ - me: { activeEmail: event.target.value } + let newState = update(this.state, { + me: { activeEmail: {$set: event.target.value }} }); + this.setState(newState); + console.log('email update'); } disableTelegram = () => { console.log('telegram disable'); @@ -161,16 +165,16 @@ export default class Settings extends React.Component { {/** email_off **/}
You can receive notifications to email:
- Sent to - {me.emails.map(email => - - )} + { + me.emails.map(email => + + ) + } - -
{/** /email_off **/}

 

diff --git a/vnext/yarn.lock b/vnext/yarn.lock index f496a8e8..f69bd0ee 100644 --- a/vnext/yarn.lock +++ b/vnext/yarn.lock @@ -3557,6 +3557,12 @@ ignore@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.2.tgz#0a8dd228947ec78c2d7f736b1642a9f7317c1905" +immutability-helper@^2.7.1: + version "2.7.1" + resolved "https://registry.yarnpkg.com/immutability-helper/-/immutability-helper-2.7.1.tgz#5636dbb593e3deb5e572766d42249ea06bae7640" + dependencies: + invariant "^2.2.0" + import-cwd@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9" -- cgit v1.2.3