diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-06-22 08:57:22 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-06-22 09:06:34 +0800 |
commit | 4375a0e07e2646d053a42aa5c852e9b2c3d8c110 (patch) | |
tree | eb53bb6758d0737a5829a0e1bf6684f5683237cf /packages/website | |
parent | a07cfb7abc3649f29ab5020ff5d2bea37c26cefd (diff) | |
download | dexon-sol-tools-4375a0e07e2646d053a42aa5c852e9b2c3d8c110.tar dexon-sol-tools-4375a0e07e2646d053a42aa5c852e9b2c3d8c110.tar.gz dexon-sol-tools-4375a0e07e2646d053a42aa5c852e9b2c3d8c110.tar.bz2 dexon-sol-tools-4375a0e07e2646d053a42aa5c852e9b2c3d8c110.tar.lz dexon-sol-tools-4375a0e07e2646d053a42aa5c852e9b2c3d8c110.tar.xz dexon-sol-tools-4375a0e07e2646d053a42aa5c852e9b2c3d8c110.tar.zst dexon-sol-tools-4375a0e07e2646d053a42aa5c852e9b2c3d8c110.zip |
Fix state mutation in reducer
Diffstat (limited to 'packages/website')
-rw-r--r-- | packages/website/ts/redux/reducer.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/website/ts/redux/reducer.ts b/packages/website/ts/redux/reducer.ts index 9d3d8f7d9..ed6a4868e 100644 --- a/packages/website/ts/redux/reducer.ts +++ b/packages/website/ts/redux/reducer.ts @@ -156,7 +156,7 @@ export function reducer(state: State = INITIAL_STATE, action: Action): State { } case ActionTypes.AddTokenToTokenByAddress: { - const newTokenByAddress = state.tokenByAddress; + const newTokenByAddress = { ...state.tokenByAddress }; newTokenByAddress[action.data.address] = action.data; return { ...state, @@ -165,7 +165,7 @@ export function reducer(state: State = INITIAL_STATE, action: Action): State { } case ActionTypes.RemoveTokenFromTokenByAddress: { - const newTokenByAddress = state.tokenByAddress; + const newTokenByAddress = { ...state.tokenByAddress }; delete newTokenByAddress[action.data.address]; return { ...state, @@ -174,7 +174,7 @@ export function reducer(state: State = INITIAL_STATE, action: Action): State { } case ActionTypes.UpdateTokenByAddress: { - const tokenByAddress = state.tokenByAddress; + const tokenByAddress = { ...state.tokenByAddress }; const tokens = action.data; _.each(tokens, token => { const updatedToken = { @@ -253,7 +253,7 @@ export function reducer(state: State = INITIAL_STATE, action: Action): State { } case ActionTypes.UpdateChosenAssetTokenAddress: { - const newAssetToken = state.sideToAssetToken[action.data.side]; + const newAssetToken = { ...state.sideToAssetToken[action.data.side] }; newAssetToken.address = action.data.address; const newSideToAssetToken = { ...state.sideToAssetToken, |