Refactor remaining _.assign to spread operator
This commit is contained in:
@@ -73,7 +73,9 @@ export class TrackTokenConfirmationDialog extends
|
||||
isAddingTokenToTracked: true,
|
||||
});
|
||||
for (const token of this.props.tokens) {
|
||||
const newTokenEntry = _.assign({}, token);
|
||||
const newTokenEntry = {
|
||||
...token,
|
||||
};
|
||||
|
||||
newTokenEntry.isTracked = true;
|
||||
trackedTokenStorage.addTrackedTokenToUser(this.props.userAddress, this.props.networkId, newTokenEntry);
|
||||
|
@@ -380,22 +380,24 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
|
||||
const isUnseenMakerToken = _.isUndefined(makerTokenIfExists);
|
||||
const isMakerTokenTracked = !_.isUndefined(makerTokenIfExists) && makerTokenIfExists.isTracked;
|
||||
if (isUnseenMakerToken) {
|
||||
tokensToTrack.push(_.assign({}, this.state.parsedOrder.maker.token, {
|
||||
tokensToTrack.push({
|
||||
...this.state.parsedOrder.maker.token,
|
||||
iconUrl: undefined,
|
||||
isTracked: false,
|
||||
isRegistered: false,
|
||||
}));
|
||||
});
|
||||
} else if (!isMakerTokenTracked) {
|
||||
tokensToTrack.push(makerTokenIfExists);
|
||||
}
|
||||
const isUnseenTakerToken = _.isUndefined(takerTokenIfExists);
|
||||
const isTakerTokenTracked = !_.isUndefined(takerTokenIfExists) && takerTokenIfExists.isTracked;
|
||||
if (isUnseenTakerToken) {
|
||||
tokensToTrack.push(_.assign({}, this.state.parsedOrder.taker.token, {
|
||||
tokensToTrack.push({
|
||||
...this.state.parsedOrder.taker.token,
|
||||
iconUrl: undefined,
|
||||
isTracked: false,
|
||||
isRegistered: false,
|
||||
}));
|
||||
});
|
||||
} else if (!isTakerTokenTracked) {
|
||||
tokensToTrack.push(takerTokenIfExists);
|
||||
}
|
||||
|
@@ -244,7 +244,9 @@ export class AssetPicker extends React.Component<AssetPickerProps, AssetPickerSt
|
||||
});
|
||||
const tokenAddress = this.state.chosenTrackTokenAddress;
|
||||
const token = this.props.tokenByAddress[tokenAddress];
|
||||
const newTokenEntry = _.assign({}, token);
|
||||
const newTokenEntry = {
|
||||
...token,
|
||||
};
|
||||
|
||||
newTokenEntry.isTracked = true;
|
||||
trackedTokenStorage.addTrackedTokenToUser(this.props.userAddress, this.props.networkId, newTokenEntry);
|
||||
|
@@ -460,9 +460,10 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala
|
||||
if (!this.state.isAddingToken && !isDefaultTrackedToken) {
|
||||
if (token.isRegistered) {
|
||||
// Remove the token from tracked tokens
|
||||
const newToken = _.assign({}, token, {
|
||||
const newToken = {
|
||||
...token,
|
||||
isTracked: false,
|
||||
});
|
||||
};
|
||||
this.props.dispatcher.updateTokenByAddress([newToken]);
|
||||
} else {
|
||||
this.props.dispatcher.removeTokenToTokenByAddress(token);
|
||||
|
Reference in New Issue
Block a user