From 3a447a8f8b026be6193d80f0e6fdbe3436ce5bfb Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 10 Sep 2018 15:22:43 +0300 Subject: [PATCH 1/2] Update token's balance on account switch --- old-ui/app/components/token-list.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/old-ui/app/components/token-list.js b/old-ui/app/components/token-list.js index 77f07e78d395..19b78df20d4a 100644 --- a/old-ui/app/components/token-list.js +++ b/old-ui/app/components/token-list.js @@ -153,7 +153,7 @@ TokenList.prototype.componentDidMount = function () { this.createFreshTokenTracker() } -TokenList.prototype.createFreshTokenTracker = function () { +TokenList.prototype.createFreshTokenTracker = function (userAddress) { if (this.tracker) { // Clean up old trackers when refreshing: this.tracker.stop() @@ -162,9 +162,8 @@ TokenList.prototype.createFreshTokenTracker = function () { } if (!global.ethereumProvider) return - const { userAddress } = this.props this.tracker = new TokenTracker({ - userAddress, + userAddress: userAddress || this.props.userAddress, provider: global.ethereumProvider, tokens: this.props.tokens, pollingInterval: 8000, @@ -194,9 +193,12 @@ TokenList.prototype.componentWillUpdate = function (nextProps) { const oldNet = this.props.network const newNet = nextProps.network - if (oldNet && newNet && newNet !== oldNet) { + const oldAddress = this.props.userAddress + const newAddress = nextProps.userAddress + + if (oldNet && newNet && (newNet !== oldNet || newAddress !== oldAddress)) { this.setState({ isLoading: true }) - this.createFreshTokenTracker() + this.createFreshTokenTracker(newAddress) } } From 351d4ede1ab3b3f7a5edb50a3aa33556a48e0f7a Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 10 Sep 2018 17:37:44 +0300 Subject: [PATCH 2/2] e2e test fix: clear decimals input before before inserting a number --- test/e2e/metamask.spec.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js index e280e0097483..a9625094b260 100644 --- a/test/e2e/metamask.spec.js +++ b/test/e2e/metamask.spec.js @@ -838,7 +838,9 @@ describe('Metamask popup page', async function () { await delay(500) await driver.findElement(By.css(screens.addToken.fieldTokenSymbol)).sendKeys(tokenName) await delay(500) - await driver.findElement(By.css(screens.addToken.fieldDecimals)).sendKeys(tokenDecimals) + const decimalsField = await driver.findElement(By.css(screens.addToken.fieldDecimals)) + await decimalsField.clear() + await decimalsField.sendKeys(tokenDecimals) const buttonAdd = await waitUntilShowUp(By.css(screens.addToken.buttonAdd)) await buttonAdd.click() return true