From 823281f9671ad92c20b8a62c811ebb11fa47ad79 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 12 Apr 2019 15:50:20 +0200 Subject: [PATCH] faster perceived loading --- client/src/App.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index 3a4dfad..0fd5074 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -143,8 +143,8 @@ class App extends Component<{}, AppState> { // Provide the Ocean // this.setState({ message: 'Connecting to Ocean...' }) - - const { ocean } = await provideOcean(this.state.web3) + const { ocean } = await provideOcean(web3provider) + this.setState({ ocean, isLoading: false }) // Get accounts const accounts = await ocean.accounts.list() @@ -153,10 +153,8 @@ class App extends Component<{}, AppState> { const balance = await accounts[0].getBalance() this.setState({ isLogged: true, - ocean, balance, - account: accounts[0].getId(), - isLoading: false + account: accounts[0].getId() }) } } else { @@ -164,13 +162,14 @@ class App extends Component<{}, AppState> { // No Web3 browser // const { ocean } = await provideOcean(this.state.web3) + this.setState({ isLoading: false }) + const network = await ocean.keeper.getNetworkName() const isNile = network === 'Nile' this.setState({ isNile, ocean, - network, - isLoading: false + network }) } } catch (e) {