Skip to content

Commit

Permalink
Make refreshNetwork async (#1182)
Browse files Browse the repository at this point in the history
The internal method `refreshNetwork` has been made async. The method
already called an asynchronous method internally, but it was not
`await`-ed. Now it is.

This method is only being called from within synchronous functions.
They will be made async in later PRs.

Because the async call was the last operation, this change effectively
has no functional impact.

This relates to #1176
  • Loading branch information
Gudahtt authored Apr 14, 2023
1 parent 364e229 commit 1d88565
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/network-controller/src/NetworkController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,14 @@ export class NetworkController extends BaseControllerV2<
};
}

private refreshNetwork() {
private async refreshNetwork() {
this.update((state) => {
state.network = 'loading';
state.networkDetails = {};
});
const { rpcTarget, type, chainId, ticker } = this.state.providerConfig;
this.configureProvider(type, rpcTarget, chainId, ticker);
this.lookupNetwork();
await this.lookupNetwork();
}

private registerProvider() {
Expand Down

0 comments on commit 1d88565

Please sign in to comment.