Skip to content

Commit

Permalink
Update onComposed logic in TransactionController
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpshr committed Sep 20, 2018
1 parent ac639da commit a42edcb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/TransactionController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ const MOCK_BLOCK_HISTORY = {
const MOCK_PRFERENCES = { state: { selectedAddress: 'foo' } };
const PROVIDER = new HttpProvider('https://ropsten.infura.io');
const MOCK_NETWORK = {
state: { network: '3', provider: PROVIDER },
provider: PROVIDER,
state: { network: '3' },
subscribe: () => {
/* eslint-disable-line no-empty */
}
Expand Down
6 changes: 3 additions & 3 deletions src/TransactionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,10 @@ export class TransactionController extends BaseController<TransactionConfig, Tra
onComposed() {
super.onComposed();
const network = this.context.NetworkController as NetworkController;
const onProviderUpdate = ({ provider }: NetworkState) => {
this.ethQuery = provider ? new EthQuery(provider) : /* istanbul ignore next */ null;
const onProviderUpdate = () => {
this.ethQuery = network.provider ? new EthQuery(network.provider) : /* istanbul ignore next */ null;
};
onProviderUpdate(network.state);
onProviderUpdate();
network.subscribe(onProviderUpdate);
}

Expand Down

0 comments on commit a42edcb

Please sign in to comment.